Simple flow control utility based on generators