docs: def to_frame(self, data, state):
          """
          Extract a single frame from the data buffer.  The consumed
          data should be removed from the buffer.  If no complete frame
          can be read, must raise a ``NoFrames`` exception.
  
          :param data: A ``bytearray`` instance containing the data so
                       far read.
          :param state: An instance of ``FramerState``.  If the buffer
                        contains a partial frame, this object can be
                        used to store state information to allow the
                        remainder of the frame to be read.
  
          :returns: A frame.  The frame may be any object.  The stock
                    framers always return bytes.
          """
  
          # If we've read all the data, let the caller know
          if state.chunk_remaining <= 0:
              raise exc.NoFrames()
  
          # OK, how much data do we send on?
          data_len = min(state.chunk_remaining, len(data))
  
          # Extract that data from the buffer
          frame = six.binary_type(data[:data_len])
          del data[:data_len]
  
          # Update the state
          state.chunk_remaining -= data_len
  
          # Return the frame
          return frame