Python Function Inside Function Creep