Added flake8 config and fixed code so the checks pass

There's a lot of pep8 ignores for now, but that's because mass-fixing
them felt silly.

Also, I don't check hscommon and qtlib yet, too much work at once.
Later.
Added tox configuration