code: def validate(
      nbdict: Any = None,
      ref: Optional[str] = None,
      version: Optional[int] = None,
      version_minor: Optional[int] = None,
      relax_add_props: bool = False,
      nbjson: Any = None,
      repair_duplicate_cell_ids: bool = _deprecated,  # type: ignore[assignment]
      strip_invalid_metadata: bool = _deprecated,  # type: ignore[assignment]
  ) -> None:
      """Checks whether the given notebook dict-like object
      conforms to the relevant notebook format schema.
  
      Parameters
      ----------
      nbdict : dict
          notebook document
      ref : optional, str
          reference to the subset of the schema we want to validate against.
          for example ``"markdown_cell"``, `"code_cell"` ....
      version : int
      version_minor : int
      relax_add_props : bool
          Whether to allow extra properties in the JSON schema validating the notebook.
          When True, all known fields are validated, but unknown fields are ignored.
      nbjson
      repair_duplicate_cell_ids : bool
          Deprecated since 5.5.0 - will be removed in the future.
      strip_invalid_metadata : bool
          Deprecated since 5.5.0 - will be removed in the future.
  
      Returns
      -------
      None
  
      Raises
      ------
      ValidationError if not valid.
  
      Notes
      -----
      Prior to Nbformat 5.5.0 the `validate` and `isvalid` method would silently
      try to fix invalid notebook and mutate arguments. This behavior is deprecated
      and will be removed in a near future.
  
      Please explicitly call `normalize` if you need to normalize notebooks.
      """
      assert isinstance(ref, str) or ref is None
  
      if strip_invalid_metadata is _deprecated:
          strip_invalid_metadata = False
      else:
          _dep_warn("strip_invalid_metadata")
  
      if repair_duplicate_cell_ids is _deprecated:
          repair_duplicate_cell_ids = True
      else:
          _dep_warn("repair_duplicate_cell_ids")
  
      # backwards compatibility for nbjson argument
      if nbdict is not None:
          pass
      elif nbjson is not None:
          nbdict = nbjson
      else:
          msg = "validate() missing 1 required argument: 'nbdict'"
          raise TypeError(msg)
  
      if ref is None:
          # if ref is not specified, we have a whole notebook, so we can get the version
          nbdict_version, nbdict_version_minor = get_version(nbdict)
          if version is None:
              version = nbdict_version
          if version_minor is None:
              version_minor = nbdict_version_minor
      # if ref is specified, and we don't have a version number, assume we're validating against 1.0
      elif version is None:
          version, version_minor = 1, 0
  
      if ref is None:
          assert isinstance(version, int)
          assert isinstance(version_minor, int)
          _normalize(
              nbdict,
              version,
              version_minor,
              repair_duplicate_cell_ids,
              relax_add_props=relax_add_props,
              strip_invalid_metadata=strip_invalid_metadata,
          )
  
      for error in iter_validate(
          nbdict,
          ref=ref,
          version=version,
          version_minor=version_minor,
          relax_add_props=relax_add_props,
          strip_invalid_metadata=strip_invalid_metadata,
      ):
          raise error
  
imports: from __future__ import annotations
  import json
  import pprint
  import warnings
  from copy import deepcopy
  from pathlib import Path
  from textwrap import dedent
  from typing import Any, Optional
  from ._imports import import_item
  from .corpus.words import generate_corpus_id
  from .json_compat import ValidationError, _validator_for_name, get_current_validator
  from .reader import get_version
  from .warnings import DuplicateCellId, MissingIDFieldWarning
label_desc: Use image node_id 12 for calling a global function with example usage: validate(nbdict, ref, version, version_minor, relax_add_props, nbjson, repair_duplicate_cell_ids, strip_invalid_metadata) without return types