a = code_reader('foobar')
print(next(a))
print(a.send('position'))
print(next(a))
print(a.send('position'))
print(a.send('position'))
print(next(a))
print(a.send('position'))
How to check if generator was used?