PEP8 tidy up for several modules
Merge pull request #2673 from felixonmars/more-tidy

PEP8 tidy up for several modules. Fixes #2673.