def validate(self, message):
        for key, field in self.fields.items():
            if key not in message:
                raise ValidationError(message, "Field %r is missing" % (key,))
            field.validate(message[key])

        if self.allow_additional_fields:
            return
        # Otherwise, additional fields are not allowed:
        fieldSet = set(self.fields) | set(RESERVED_FIELDS)
        for key in message:
            if key not in fieldSet:
                raise ValidationError(message, "Unexpected field %r" % (key,))
:param log_dir: directory to save the stats.
dataset/ETHPy150Open ClusterHQ/eliot/eliot/_validation.py/_MessageSerializer.validate--crossover with--dataset/ETHPy150Open ppwwyyxx/tensorpack/tensorpack/callbacks/summary.py/StatHolder.__init__