code: def _stream(self, context, message_factory):
          
          args = []
          try:
              for argstream in context.argstreams:
                  chunk = yield argstream.read()
                  args.append(chunk)
                  chunk = yield argstream.read()
                  while chunk:
                      message = (message_factory.
                                 build_raw_message(context, args))
                      yield self.write(message)
                      args = [chunk]
                      chunk = yield argstream.read()
  
              # last piece of request/response.
              message = (message_factory.
                         build_raw_message(context, args, is_completed=True))
              yield self.write(message)
              context.state = StreamState.completed
          # Stop streamming immediately if exception occurs on the handler side
          except TChannelError:
              # raise by tchannel intentionally
              log.info("Stopped outgoing streams because of an error",
                       exc_info=sys.exc_info())
docs: write request/response into frames
  
          Transform request/response into protocol level message objects based on
          types and argstreams.
  
          Assumption: the chunk data read from stream can fit into memory.
  
          If arg stream is at init or streaming state, build the message based on
          current chunk. If arg stream is at completed state, put current chunk
          into args[] array, and continue to read next arg stream in order to
          compose a larger message instead of sending multi small messages.
  
          Note: the message built at this stage is not guaranteed the size is
          less then 64KB.
  
          Possible messages created sequence:
  
          Take request as an example::
          CallRequestMessage(flags=fragment)
              --> CallRequestContinueMessage(flags=fragment)
              ....
              --> CallRequestContinueMessage(flags=fragment)
                  --> CallRequestMessage(flags=none)
  
          :param context: Request or Response object