<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cookie_eater(ctx):
 """Eat cookies as they're baked."""

    state = ctx.create_state()
    state["ready"] = True

    for _ in state.when_change("cookies"):
        eat_cookie(state)