syntax of nested if statement in python