cleanup of the python notebook code