strip trailing whitespace, PEP8 changes

https://mediawiki.org/wiki/Special:Code/pywikipedia/11692