docs: def task_wait_with_io(
      meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code, client=None
  ):
      """
      Options are the core "task wait" options, including the `--meow` easter
      egg.
  
      This does the core "task wait" loop, including all of the IO.
      It *does exit* on behalf of the caller. (We can enhance with a
      `noabort=True` param or somesuch in the future if necessary.)
      """
      client = client or get_client()
  
      def timed_out(waited_time):
          if timeout is None:
              return False
          else:
              return waited_time >= timeout
  
      def check_completed():
          completed = client.task_wait(
              task_id, timeout=polling_interval, polling_interval=polling_interval
          )
          if completed:
              if heartbeat:
                  safeprint("", write_to_stderr=True)
              # meowing tasks wake up!
              if meow:
                  safeprint(
                      r"""
                    _..
    /}_{\           /.-'
   ( a a )-.___...-'/
   ==._.==         ;
        \ i _..._ /,
        {_;/   {_//""",
                      write_to_stderr=True,
                  )
  
              # TODO: possibly update TransferClient.task_wait so that we don't
              # need to do an extra fetch to get the task status after completion
              res = client.get_task(task_id)
              formatted_print(res, text_format=FORMAT_SILENT)
  
              status = res["status"]
              if status == "SUCCEEDED":
                  click.get_current_context().exit(0)
              else:
                  click.get_current_context().exit(1)
  
          return completed
  
      # Tasks start out sleepy
      if meow:
          safeprint(
              r"""
     |\      _,,,---,,_
     /,`.-'`'    -.  ;-;;,_
    |,4-  ) )-,_..;\ (  `'-'
   '---''(_/--'  `-'\_)""",
              write_to_stderr=True,
          )
  
      waited_time = 0
      while not timed_out(waited_time) and not check_completed():
          if heartbeat:
              safeprint(".", write_to_stderr=True, newline=False)
              sys.stderr.flush()
  
          waited_time += polling_interval
  
      # add a trailing newline to heartbeats if we fail
      if heartbeat:
          safeprint("", write_to_stderr=True)
  
      exit_code = 1
      if timed_out(waited_time):
          safeprint(
              "Task has yet to complete after {} seconds".format(timeout),
              write_to_stderr=True,
          )
          exit_code = timeout_exit_code
  
      # output json if requested, but nothing for text mode
      res = client.get_task(task_id)
      formatted_print(res, text_format=FORMAT_SILENT)
  
      click.get_current_context().exit(exit_code)