PEP8 fixes

This jumbo patch fixes all of the warnings from pep8 except for the following:
E111 -- indentation is not a multiple of four
E302 -- expected 2 blank lines, found 1
E501 -- line too long

Checked carefully with diff -w.