pep8 and minor stylistic changes

I removed a lot of trailing whitespace, so probably easier to review with [?w=1](https://github.com/dimagi/dimagi-utils/pull/222/files?w=1) in the URL.