<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def animate_cli(animation_, step, event):
 """Print out the animation cycle to stdout. This function is for use with synchronous functions and must be run in a thread. Args: animation_ (generator):
 A generator that produces strings for the animation. Should be endless. step (float):
 Seconds between each animation frame. """

    while True:  # run at least once, important for tests!
        time.sleep(step)
        frame = next(animation_)
        sys.stdout.write(frame)
        sys.stdout.flush()
        if event.is_set():
            break
    sys.stdout.write(animation_.get_erase_frame())
    sys.stdout.flush()
    animation_.reset()