Python Use Variable In Nested Function