nested if else statement in python diagram