Make unit tests pass under Python 3 and 2

Unit tests pass when run under either Python 2 or Python 3. That said, the
apparent success of this conversion is suspect. Strings have not been
universally converted to unicode, and there are a worrisome number of functions
floating around (like `chr` and `str`) that have a different meaning under
Python 3 vs 2. There are other possible issues with the codebase, such as the
fact that division and import handling have changed between versions, and these
issues have not been thoroughly addressed.