Cleanups to pass flake8
Fix missing import of 'os' in setup.py

This was "working" because of a bare "try: except:" which was hiding an
error.  Fixed that, too.
Move `to_json` and `base64` into a utils module

This will allow them to be used from elsewhere without importing all the
auth code.
Merge pull request #6 from alphagov/flake8-fixes

Flake8 fixes