code: def resolve_pointer(self, document, pointer):
          
          # Do only split at single forward slashes which are not prefixed by a caret
          parts = re.split(r"(?<!\^)/", unquote(pointer.lstrip("/"))) if pointer else []
  
          for part in parts:
              # Restore escaped slashes and carets
              replacements = {r"^/": r"/", r"^^": r"^"}
              part = re.sub(
                  "|".join(re.escape(key) for key in replacements.keys()),
                  lambda k: replacements[k.group(0)],
                  part,
              )
              if isinstance(document, Sequence):
                  # Try to turn an array index to an int
                  try:
                      part = int(part)
                  except ValueError:
                      pass
              try:
                  document = document[part]
              except (TypeError, LookupError) as e:
                  self._error("Unresolvable JSON pointer: %r" % pointer, cause=e)
          return document
docs: Resolve a json pointer ``pointer`` within the referenced ``document``.
  
          :argument document: the referent document
          :argument str pointer: a json pointer URI fragment to resolve within it