Clean up of python code.