syntax for nested if statement in python