state machine
Yield in Python – beyond the data generation