PEP8 and formatting changes.

All of these should just be reformatting or replacing a
deprecated feature. If any functionality has changed then that
is a mistake in this commit.