Fix many style and format warnings from the flake8 tool.

This makes us more conformant with PEP 8. Warnings caused by using tabs
instead of spaces have not been fixed.  For now, we can just write a config
file to ignore them.