docs: def validate(self, protocol_version):
          """Validate message."""
          const = get_const(protocol_version)
          valid_node_ids = vol.All(vol.Coerce(int), vol.Range(
              min=0, max=BROADCAST_ID, msg='Not valid node_id: {}'.format(
                  self.node_id)))
          valid_child_ids = vol.All(vol.Coerce(int), vol.Range(
              min=0, max=SYSTEM_CHILD_ID, msg='Not valid child_id: {}'.format(
                  self.child_id)))
          if self.type in (const.MessageType.internal, const.MessageType.stream):
              valid_child_ids = vol.All(vol.Coerce(int), vol.In(
                  [SYSTEM_CHILD_ID],
                  msg='When message type is {}, child_id must be {}'.format(
                      self.type, SYSTEM_CHILD_ID)))
          if (self.type == const.MessageType.internal and
                  self.sub_type in [
                      const.Internal.I_ID_REQUEST,
                      const.Internal.I_ID_RESPONSE]):
              valid_child_ids = vol.Coerce(int)
          valid_types = vol.All(vol.Coerce(int), vol.In(
              [member.value for member in const.VALID_MESSAGE_TYPES],
              msg='Not valid message type: {}'.format(self.type)))
          if self.child_id == SYSTEM_CHILD_ID:
              valid_types = vol.All(vol.Coerce(int), vol.In(
                  [const.MessageType.presentation.value,
                   const.MessageType.internal.value,
                   const.MessageType.stream.value],
                  msg=(
                      'When child_id is {}, {} is not a valid '
                      'message type'.format(SYSTEM_CHILD_ID, self.type))))
          valid_ack = vol.In([0, 1], msg='Not valid ack flag: {}'.format(
              self.ack))
          valid_sub_types = vol.In(
              [member.value for member
               in const.VALID_MESSAGE_TYPES.get(self.type, [])],
              msg='Not valid message sub-type: {}'.format(self.sub_type))
          valid_payload = const.VALID_PAYLOADS.get(
              self.type, {}).get(self.sub_type, '')
          schema = vol.Schema({
              'node_id': valid_node_ids, 'child_id': valid_child_ids,
              'type': valid_types, 'ack': valid_ack, 'sub_type': valid_sub_types,
              'payload': valid_payload})
          to_validate = {attr: getattr(self, attr) for attr in schema.schema}
          return schema(to_validate)