code: def _canonicalize_dtype(
      x64_enabled: bool, allow_extended_dtype: bool, dtype: Any
  ) -> DType | ExtendedDType:
      if issubdtype(dtype, extended):
          if not allow_extended_dtype:
              raise ValueError(
                  f"Internal: canonicalize_dtype called on extended dtype {dtype} "
                  "with allow_extended_dtype=False"
              )
          return dtype
      try:
          dtype_ = np.dtype(dtype)
      except TypeError as e:
          raise TypeError(f"dtype {dtype!r} not understood") from e
  
      if x64_enabled:
          return dtype_
      else:
          return _dtype_to_32bit_dtype.get(dtype_, dtype_)
  
imports: from __future__ import annotations
  import abc
  import builtins
  import functools
  from typing import cast, overload, Any, Literal, Union
  import warnings
  import ml_dtypes
  import numpy
  from jax._src import config
  from jax._src.typing import DType, DTypeLike
  from jax._src.util import set_module
  from jax._src import traceback_util
label_desc: Use image node_id 5 for calling a global function with example usage: _canonicalize_dtype(x64_enabled, allow_extended_dtype, dtype) and returns: dtype, dtype_, _dtype_to_32bit_dtype