Make a bunch of smaller 2to3 related refactors.

This change makes a bunch of small updates to bring code into compliance with
both Python 2.x and 3.x.

Testing done:
- Ran unit tests.
- Posted some changes.

Reviewed at https://reviews.reviewboard.org/r/6681/