flake8 (pep8 and pyflakes) clean-up

Continuing the effort started by @nekto0n, I ran [flake8](http://flake8.readthedocs.org/en/2.0/) on the whole project to:

- clean pep8 issues
- remove unused imports (pyflakes)