PEP8 almost everything

First attempt to get the code PEP8 (https://www.python.org/dev/peps/pep-0008/) valid. Had to sort out tabs and spacing and a few other style things.

This doesn't change how anything works but makes it closer to being PEP8 compliant. Sorry it's a such a big PR.

It's nothing personal about you or your coding style, it's just to make the code follow the Python style guide. I used https://pypi.python.org/pypi/pep8 to "validate" the code.