Update a bunch of newer code to be compatible with Python 3.

Since I initially went through and ported our code to Python 3, we've written a
bunch of new stuff. A lot of this stuff, especially the stuff that was done
initially on the release-1.7.x branch, didn't use the newer conventions for 2/3
compatibility. There were also a few lingering things that I hadn't ported yet
(like the `execfile()` call in rb-site).

Testing done: Ran unit tests.

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