fix whitespace to comply with pep8

- tabs => 4 spaces (including readme)
- two newlines separating top-level declarations
- one newline separating nested declarations
- one newline at end of file
- no whitespace at the end of lines
- single space following (only) certain operators
clean up imports