Fix import whitespace
Simplify conditional logic
Remove unused import
Simplify conditional logic
Clean up imports
Don't use lambda unneccesarily

http://legacy.python.org/dev/peps/pep-0008/#programming-recommendations