def METHOD_NAME(self):
    """
    Empty the queue of messages to write
    Will fragment the messages and write them in as little records as
    possible.
    :rtype: generator
    """
    while len(self._sendBuffer) > 0:
        recordPayload = self._sendBuffer[:self.recordSize]
        self._sendBuffer = self._sendBuffer[self.recordSize:]
        msg = Message(self._sendBufferType, recordPayload)
        for res in self.sendRecord(msg):
            yield res
    assert len(self._sendBuffer) == 0
    self._sendBufferType = None