code: def __flush_buffer(self):
          
          def ok(_):
              self._buffer.close()
              self._buffer = StringIO()
          return self.__flush_data(self._buffer.getvalue()).addCallback(ok)
docs: Flush the buffer contents out to a chunk.