Nested if Statement in Python