Bring closer to conformance to PEP 8.

Remove extra whitespace, add whitespace, and rework some conditional
expressions. Hopefully make no changes to functionality.