Python Function Use Variable From Outer Scope