First - try to recognize the basic premise that usually parents would never lose their temper that way with anyone who isn't their child. Knowing this is easy - remembering it in the heat of the moment is the only challenge you have - good to know, you can do that!
Second - pretend this isn't "your" child. How would you teach, show, tell and help any other child on earth how to handle this particular situation better? You can imagine that, right? This isn't your child, this is a child of the universe, or a young soul needing guidance who trusts you and someone who, down the road, will appreciate your respect.
Third - plan ahead, now. If you want to breathe, make sure you do that. If you prefer to have the dialog along the lines of "well, how do you think you would handle this moment if you were mommy or daddy?" Believe it or not, this has actually worked for me, and taken the sting out for everyone. It becomes a discussion about how we act, what feels good and how we can move forward.
Is it easy? YES! It is easy - I promise. When we see kids as people longing to get along and learn then we have changed the game, they pick it up quick because they are so intuitive. We uplift them, help them adore their options and want to try out new behaviors. Overall, they actually know in their gut fighting takes so much more energy than being happy and having fun. If there is anything I've learned, it's that the more "adult" and "serious" I might be, the more my kids do something to snap me out of it, and back into the loving person I was born to be.