syntax for nested if statement in pythonの検索結果