Just in the nick of time.

This is a pretty scary video of a pilot who entered a flat spin (by accident) while trying to do a normal spin. I suspect the engine quit because the forces of the spin caused an imbalenced fuel flow.

At the end, the aircraft flipped over because the landing gear snagged some barbwire that the pilot didn’t see.