python does not allow nested if statement true or false