Python End Loop If Condition Met