code: def _read_data_handler(length, whence, ctx, skip=False, stream_event=ION_STREAM_INCOMPLETE_EVENT):
      
      trans = None
      queue = ctx.queue
  
      if length > ctx.remaining:
          raise IonException('Length overrun: %d bytes, %d remaining' % (length, ctx.remaining))
  
      # Make sure to check the queue first.
      queue_len = len(queue)
      if queue_len > 0:
          # Any data available means we can only be incomplete.
          stream_event = ION_STREAM_INCOMPLETE_EVENT
      length -= queue_len
  
      if skip:
          # For skipping we need to consume any remnant in the buffer queue.
          if length >= 0:
              queue.skip(queue_len)
          else:
              queue.skip(queue_len + length)
  
      while True:
          data_event, self = (yield trans)
          if data_event is not None and data_event.data is not None:
              data = data_event.data
              data_len = len(data)
              if data_len > 0:
                  # We got something so we can only be incomplete.
                  stream_event = ION_STREAM_INCOMPLETE_EVENT
              length -= data_len
              if not skip:
                  queue.extend(data)
              else:
                  pos_adjustment = data_len
                  if length < 0:
                      pos_adjustment += length
                      # More data than we need to skip, so make sure to accumulate that remnant.
                      queue.extend(data[length:])
                  queue.position += pos_adjustment
          if length <= 0:
              # We got all the data we need, go back immediately
              yield Transition(None, whence)
  
          trans = Transition(stream_event, self)
docs: Creates a co-routine for retrieving data up to a requested size.
  
      Args:
          length (int): The minimum length requested.
          whence (Coroutine): The co-routine to return to after the data is satisfied.
          ctx (_HandlerContext): The context for the read.
          skip (Optional[bool]): Whether the requested number of bytes should be skipped.
          stream_event (Optional[IonEvent]): The stream event to return if no bytes are read or
              available.