def count(x): x-= 1 def do_count(): nonlocal x x += 1 return x return do_count