PEP8ify some function calls and defs
Flatten some try-except blocks
Use set_defaults instead of dict for subcommand handlers