code: def frameify(self, state, data):
          
  
          # If we've pulled in all the chunk data, buffer the data
          if state.chunk_remaining <= 0:
              state.recv_buf += data
              return
  
          # Pull in any partially-processed data
          data = state.recv_buf + data
  
          # Determine how much belongs to the chunk
          if len(data) <= state.chunk_remaining:
              chunk = data
              data = ''
          else:
              # Pull out only what's part of the chunk
              chunk = data[:state.chunk_remaining]
              data = data[state.chunk_remaining:]
  
          # Update the state
          state.recv_buf = data
          state.chunk_remaining -= len(chunk)
  
          # Yield the chunk
          try:
              yield chunk
          except FrameSwitch:
              pass
docs: Yield chunk data as a single frame, and buffer the rest.