Py3k compatibility

All tests pass under tox against Python 2.6, 2.7, 3.2, and 3.3.