Python Recursive Function Global Variable Definition