More work on the port to Python.