code: def animate_cli(animation_, step, event):
      
      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()
docs: 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.