PEP8-ify

In addition to PEP8 rules, split out and reorder the imports to signify
STDLIB vs other imports, and capitalize global variables.