code: def _dtype_can_hold_element(dtype: np.dtype, element) -> bool:
      if dtype.kind in {"i", "u"}:
          if isinstance(element, range):
              if _dtype_can_hold_range(element, dtype):
                  return True
              return False
  
          elif is_integer(element) or (
              is_float(element) and element.is_integer()
          ):
              info = np.iinfo(dtype)
              if info.min <= element <= info.max:
                  return True
              return False
  
      elif dtype.kind == "f":
          if is_integer(element) or is_float(element):
              casted = dtype.type(element)
              if np.isnan(casted) or casted == element:
                  return True
              # otherwise e.g. overflow see TestCoercionFloat32
              return False
  
      elif dtype.kind == "b":
          if is_bool(element):
              return True
          return False
  
      raise NotImplementedError(f"Unsupported dtype: {dtype}")
  
imports: import datetime
  from collections import namedtuple
  from decimal import Decimal
  import cupy
  import numpy
  import pandas
  import pyarrow
  from pandas.core.dtypes.common import infer_dtype_from_object
  import cudf
  from cudf._typing import DtypeObj
  from cudf.api.types import is_bool, is_float, is_integer
label_desc: Use image node_id 25 for calling a global function with example usage: _dtype_can_hold_element(dtype, element) and returns: False, True, False, False, False, True, True, True