Pep8 compliance and other small cosmetic improvements

Hi,

first: you don't have to accept this one, just wanted to show how this code would look if it would be fully (except E501: line length) PEP8 compliant.

But maybe you can have a look to the last few commits, they contain some python-related improvements.