Assign message types based on the clusters. Following rules:
        1) Messages from different clusters will get different message types
        2) Messages from same clusters will get same message type
        3) The new message type will copy over the existing labels
        4) No new message type will be set for messages, that already have a custom message type assigned

        For messages with clustername "default" no new message type will be created

        :param messages: Messages, that messagetype needs to be clustered
        :param clusters: clusters for the messages
        :type messages: list[Message]
        :type clusters: dict[str, set[int]]
        :return:

def assign_messagetypes(self, messages, clusters):
        """
        Assign message types based on the clusters. Following rules:
        1) Messages from different clusters will get different message types
        2) Messages from same clusters will get same message type
        3) The new message type will copy over the existing labels
        4) No new message type will be set for messages, that already have a custom message type assigned

        For messages with clustername "default" no new message type will be created

        :param messages: Messages, that messagetype needs to be clustered
        :param clusters: clusters for the messages
        :type messages: list[Message]
        :type clusters: dict[str, set[int]]
        :return:
        """
        for clustername, clustercontent in clusters.items():
            if clustername == "default":
                # Do not force the default message type
                continue

            for msg_i in clustercontent:
                msg = messages[msg_i]
                if msg.message_type == self.messagetypes[0]:
                    # Message has default message type
                    # Copy the existing labels and create a new message type
                    # if it was not already done
                    try:
                        msg_type = next(mtype for mtype in self.messagetypes if mtype.name == clustername)
                    except StopIteration:
                        msg_type = MessageType(name=clustername, iterable=msg.message_type)
                        msg_type.assigned_by_logic_analyzer = True
                        self.messagetypes.append(msg_type)
                    msg.message_type = msg_type