[python] How to condense if/else into one line in Python?