'Send the message to the matrix server.'

def send_message(self, message, **kwargs):

    from matrix_client.client import MatrixRequestError
    target_rooms = (kwargs.get(ATTR_TARGET) or [self.default_room])
    rooms = self.client.get_rooms()
    for target_room in target_rooms:
        try:
            if (target_room in rooms):
                room = rooms[target_room]
            else:
                room = self.client.join_room(target_room)
            _LOGGER.debug(room.send_text(message))
        except MatrixRequestError as ex:
            _LOGGER.error("Unable    to    deliver    message    to    room    '%s':    (%d):    %s", target_room, ex.code, ex.content)
