PEP8 compliance

(checked with pep8 command line tool)

* removed whitespaces at blank lines
* split long lines
* normalized blank lines
* removed spaces before and after brackets
* spaces around commas and operators
* fixed indentation
* None/True/False matching with 'is' and 'is not'
* removed trailing spaces
* .has_key() replaced with 'in'