Working Python 3 port: all tests in run_tests.py pass.