Code cleanup.

Fix:
- pep8 violations
- pyflakes violations
- imports
- indentation fails