Python Nested Function Outer Variable Annuity