Python Rewrite