Fixed pep8 errors

Some recent commits introduced some code not following the pep8 coding standard.
For example, mixing of spaces and tabs, and inconsistent indentation.

This pull request fixes it.