def type(self, value):
        """
        Sets the type of the message.

        :type value: Types
        :param value: the type
        :raise AttributeError: if value is not a valid type
        """
        if value not in list(defines.Types.values()):
            raise AttributeError
        self._type = value
Sets the type of the message.

        :type value: Types
        :param value: the type
        :raise AttributeError: if value is not a valid type