class_docstr: Restricts specified DHT keys to match a Pydantic schema.
  This allows to enforce types, min/max values, require a subkey to contain a public key, etc.
class_docstr_tok: ["Restricts","specified","DHT","keys","to","match","a","Pydantic","schema",".","This","allows","to","enforce","types",",","min\/max","values",",","require","a","subkey","to","contain","a","public","key",",","etc","."]
code: def _is_failed_due_to_extra_field(exc: pydantic.ValidationError):
      inner_errors = exc.errors()
      return (
          len(inner_errors) == 1
          and inner_errors[0]["type"] == "value_error.extra"
          and len(inner_errors[0]["loc"])
          == 1  # Require the extra field to be on the top level
      )
  
file_path: hivemind/hivemind/dht/schema.py
imports: import re
  from typing import Any, Dict, Optional, Type
  import pydantic
  from hivemind.dht.crypto import RSASignatureValidator
  from hivemind.dht.protocol import DHTProtocol
  from hivemind.dht.routing import DHTID
  from hivemind.dht.validation import DHTRecord, RecordValidatorBase
  from hivemind.utils import get_logger
label_desc: Use image node_id 5 for calling the SchemaValidator obj's underlying member method code with example usage: obj._is_failed_due_to_extra_field(exc) and returns: unknown