code: def validate_key(key: object) -> None:
      """Validate the format of a dask key.
  
      See Also
      --------
      iskey
      """
      if iskey(key):
          return
      typ = type(key)
  
      if typ is tuple:
          index = None
          try:
              for index, part in enumerate(
                  cast(tuple, key)
              ):  # noqa: B007
                  validate_key(part)
          except TypeError as e:
              raise TypeError(
                  f"Composite key contains unexpected key type at {index=} ({key=!r})"
              ) from e
      raise TypeError(f"Unexpected key type {typ} ({key=!r})")
  
imports: from __future__ import annotations
  from collections import defaultdict
  from collections.abc import Collection, Iterable, Mapping
  from typing import Any, Literal, TypeVar, cast, overload
  from dask.typing import Graph, Key, NoDefault, no_default
label_desc: Use image node_id 10 for calling a global function with example usage: validate_key(key) without return types