Some clean up.
Re-organised imports.
See http://www.python.org/dev/peps/pep-0008/#imports
Some PEP enforcing.
See http://www.python.org/dev/peps/pep-0008