nested if statement in python syntax