'Append a Message to the MessageSet.
Arguments:
offset (int): offset of the message
message (Message or bytes): message struct or encoded bytes
Returns: bytes written'

def append(self, offset, message):

    if isinstance(message, Message):
        encoded = message.encode()
    else:
        encoded = bytes(message)
    msg = ((Int64.encode(offset) + Int32.encode(len(encoded))) + encoded)
    self._buffer.write(msg)
    self._messages += 1
    self._bytes_written += len(msg)
    return len(msg)
