1. def counter(base):
    2. def inc(step=1):
    3. nonlocal base
    4. base = base + step
    5. return base
    6. return inc
    7. foo = counter(10)
    8. print(foo())