def init():
'''
:return: increment_num function
'''
num = 0
def increment_num():
'''
increments a number by one each call
:return: num + 1
'''
nonlocal num
num += 1
return num
return increment_num
increment = init()
print(increment())
print(increment())
# output 1 2