various pep-8 cleanups; remove unsused imports; remove unused variables

A number of PEP-8 related cleanups. Also removing unused imports and unused variables.
I'd consider these if the first parameter was included on the first line.