Finish porting djblets to Python 2/3 compatibility.

This change finishes up the last bits of djblets for Python 2/3 compatibility.
Most of this was just left-over pieces from my previous efforts, with a little
bit of newly-written code sprinkled in.

Testing done: Ran unit tests.