style fixes

This branch fixes a bunch of PEP8 style issues, and removes a couple of unused imports.

I check using `flake8 --ignore=E501` so it's everything flake8 detects except long lines.