cleanup of python code