Flake8 fixes

- add utf-8 support
- multiple imports on one line
- 'sys' imported but unused
- multiple spaces before operator
- fix indentation
- remove trailing whitespace