You can use generators to simplify nested loops and make it easier to break out of them.
Thank you MathGurl for having inspired me so much.