def METHOD_NAME(self, inst, data=''):
    data_bytes = data.encode()
    data_len = len(data_bytes)
    # one byte for inst, two bytes for size, and n bytes for data(Optional)
    raw_bytes = inst.to_bytes(1, 'big') + data_len.to_bytes(2, 'big') + data_bytes
    self.socket.send(raw_bytes)