code: def _normalise_numpy_dtype(dtype: Any) -> tuple[Any, Any]:
      normalised_dtype = (
          np.dtype(dtype.base.name)
          if dtype.kind in ("i", "u", "f")
          else dtype
      ).type
      cast_as: Any = None
      if normalised_dtype == np.float16:
          normalised_dtype = cast_as = np.float32
      elif normalised_dtype in (np.datetime64, np.timedelta64):
          time_unit = np.datetime_data(dtype)[0]
          if time_unit in dt.DTYPE_TEMPORAL_UNITS or (
              time_unit == "D" and normalised_dtype == np.datetime64
          ):
              cast_as = np.int64
          else:
              raise ValueError(
                  "incorrect NumPy datetime resolution"
                  "\n\n'D' (datetime only), 'ms', 'us', and 'ns' resolutions are supported when converting from numpy.{datetime64,timedelta64}."
                  " Please cast to the closest supported unit before converting."
              )
      return normalised_dtype, cast_as
  
file_path: polars/py-polars/polars/datatypes/constructor.py
imports: from __future__ import annotations
  import functools
  from decimal import Decimal
  from typing import TYPE_CHECKING, Any, Callable, Sequence
  from polars import datatypes
  from polars.dependencies import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: _normalise_numpy_dtype(dtype) and returns: normalised_dtype,  cast_as