code: def add_path_resolver(cls, tag, path, kind=None):
      # Note: `add_path_resolver` is experimental.  The API could be changed.
      # `new_path` is a pattern that is matched against the path from the
      # root to the node that is being considered.  `node_path` elements are
      # tuples `(node_check, index_check)`.  `node_check` is a node class:
      # `ScalarNode`, `SequenceNode`, `MappingNode` or `None`.  `None`
      # matches any kind of a node.  `index_check` could be `None`, a boolean
      # value, a string value, or a number.  `None` and `False` match against
      # any _value_ of sequence and mapping nodes.  `True` matches against
      # any _key_ of a mapping node.  A string `index_check` matches against
      # a mapping value that corresponds to a scalar key which content is
      # equal to the `index_check` value.  An integer `index_check` matches
      # against a sequence value with the index equal to `index_check`.
      if not "yaml_path_resolvers" in cls.__dict__:
          cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy()
      new_path = []
      for element in path:
          if isinstance(element, (list, tuple)):
              if len(element) == 2:
                  node_check, index_check = element
              elif len(element) == 1:
                  node_check = element[0]
                  index_check = True
              else:
                  raise ResolverError(
                      "Invalid path element: %s" % element
                  )
          else:
              node_check = None
              index_check = element
          if node_check is str:
              node_check = ScalarNode
          elif node_check is list:
              node_check = SequenceNode
          elif node_check is dict:
              node_check = MappingNode
          elif (
              node_check not in [ScalarNode, SequenceNode, MappingNode]
              and not isinstance(node_check, str)
              and node_check is not None
          ):
              raise ResolverError(
                  "Invalid node checker: %s" % node_check
              )
          if (
              not isinstance(index_check, (str, int))
              and index_check is not None
          ):
              raise ResolverError(
                  "Invalid index checker: %s" % index_check
              )
          new_path.append((node_check, index_check))
      if kind is str:
          kind = ScalarNode
      elif kind is list:
          kind = SequenceNode
      elif kind is dict:
          kind = MappingNode
      elif (
          kind not in [ScalarNode, SequenceNode, MappingNode]
          and kind is not None
      ):
          raise ResolverError("Invalid node kind: %s" % kind)
      cls.yaml_path_resolvers[tuple(new_path), kind] = tag
  
file_path: keepsake/python/keepsake/_vendor/yaml/resolver.py
imports: from .error import *
  from .nodes import *
  import re
label_desc: Use image node_id 3 for calling the BaseResolver obj's underlying member method code with example usage: obj.add_path_resolver(cls, tag, path, kind) without return types