code: def handle_numpy_casting(fn: Callable) -> Callable:
      @functools.wraps(fn)
      def _handle_numpy_casting(
          *args, casting="same_kind", dtype=None, **kwargs
      ):
          """Check numpy casting type.
  
          Parameters
          ----------
          args
              The arguments to be passed to the function.
  
          kwargs
              The keyword arguments to be passed to the function.
  
          Returns
          -------
              The return of the function, or raise IvyException if error is thrown.
          """
          ivy.utils.assertions.check_elem_in_list(
              casting,
              ["no", "equiv", "safe", "same_kind", "unsafe"],
              message="casting must be one of [no, equiv, safe, same_kind, unsafe]",
          )
          args = list(args)
          args_scalar_idxs = ivy.nested_argwhere(
              args, lambda x: isinstance(x, (int, float, bool))
          )
          args_scalar_to_check = ivy.multi_index_nest(
              args, args_scalar_idxs
          )
          args_idxs = ivy.nested_argwhere(args, ivy.is_array)
          args_to_check = ivy.multi_index_nest(args, args_idxs)
  
          if casting in ["no", "equiv"]:
              none = not dtype
              if none:
                  dtype = (
                      args_to_check[0].dtype if args_to_check else None
                  )
              _assert_no_array(
                  args_to_check,
                  dtype,
                  scalar_check=(args_to_check and args_scalar_to_check),
                  none=none,
              )
              _assert_no_scalar(args_scalar_to_check, dtype, none=none)
          elif casting in ["same_kind", "safe"]:
              _assert_array(
                  args_to_check,
                  dtype,
                  scalar_check=(args_to_check and args_scalar_to_check),
                  casting=casting,
              )
              _assert_scalar(args_scalar_to_check, dtype)
  
          if ivy.exists(dtype):
              ivy.map_nest_at_indices(
                  args,
                  args_idxs,
                  lambda x: ivy.astype(x, ivy.as_ivy_dtype(dtype)),
              )
  
          return fn(*args, **kwargs)
  
      _handle_numpy_casting.handle_numpy_casting = True
      return _handle_numpy_casting
  
imports: import functools
  from typing import Callable, Any
  import inspect
  import platform
  import ivy
  import ivy.functional.frontends.numpy
label_desc: Use image node_id 15 for calling a global function with example usage: handle_numpy_casting(fn) and returns: _handle_numpy_casting, fn