Initial port to Python 3.