clean up python code