Pep8 fixes, simplified

A replacement for PR #1074, with de-mangled Git history.