This is the first thing that comes to my mind:
Instead of doing this:
if option1:
a = 1
elif oprtion2:
a = 2
elif oprtion3:
a = 3
else:
a = 0
You can do this:
a = 1 if option1 else 2 if option 2 else 3 if option3 else 0
For more detail, see: PEP 308: Conditional Expressions!