code: def _scalar_type_to_dtype(typ: type, value: Any = None) -> DType:
      """Return the numpy dtype for the given scalar type.
  
      Raises
      ------
      OverflowError: if `typ` is `int` and the value is too large for int64.
  
      Examples
      --------
      >>> _scalar_type_to_dtype(int)
      dtype('int32')
      >>> _scalar_type_to_dtype(float)
      dtype('float32')
      >>> _scalar_type_to_dtype(complex)
      dtype('complex64')
      >>> _scalar_type_to_dtype(int)
      dtype('int32')
      >>> _scalar_type_to_dtype(int, 0)
      dtype('int32')
      >>> _scalar_type_to_dtype(int, 1 << 63)  # doctest: +IGNORE_EXCEPTION_DETAIL
      Traceback (most recent call last):
      OverflowError: Python int 9223372036854775808 too large to convert to int32
      """
      dtype = canonicalize_dtype(python_scalar_dtypes[typ])
      if typ is int and value is not None:
          if value < np.iinfo(dtype).min or value > np.iinfo(dtype).max:
              raise OverflowError(
                  f"Python int {value} too large to convert to {dtype}"
              )
      return 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 10 for calling a global function with example usage: _scalar_type_to_dtype(typ, value) and returns: dtype