Tidying up the Python interface.