Python Nested Function Global Variable In Js