python break for loop with if statement