code: def as_ivy_dtype(
      dtype_in: Union[np.dtype, str, int, float, complex, bool],
      /,
  ) -> ivy.Dtype:
      if dtype_in is int:
          return ivy.default_int_dtype()
      if dtype_in is float:
          return ivy.default_float_dtype()
      if dtype_in is complex:
          return ivy.default_complex_dtype()
      if dtype_in is bool:
          return ivy.Dtype("bool")
  
      if isinstance(dtype_in, str):
          if dtype_in in char_rep_dtype_dict:
              return as_ivy_dtype(char_rep_dtype_dict[dtype_in])
          if dtype_in in native_dtype_dict:
              dtype_str = dtype_in
          else:
              raise ivy.utils.exceptions.IvyException(
                  "Cannot convert to ivy dtype."
                  f" {dtype_in} is not supported by NumPy backend."
              )
      else:
          dtype_str = ivy_dtype_dict[dtype_in]
  
      if "uint" in dtype_str:
          return ivy.UintDtype(dtype_str)
      elif "int" in dtype_str:
          return ivy.IntDtype(dtype_str)
      elif "float" in dtype_str:
          return ivy.FloatDtype(dtype_str)
      elif "complex" in dtype_str:
          return ivy.ComplexDtype(dtype_str)
      elif "bool" in dtype_str:
          return ivy.Dtype("bool")
      else:
          raise ivy.utils.exceptions.IvyException(
              f"Cannot recognize {dtype_str} as a valid Dtype."
          )
  
imports: from typing import Optional, Union, Sequence, List
  import numpy
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from ivy.functional.ivy.data_type import _handle_nestable_dtype_info
  from .None import backend_version
label_desc: Use image node_id 7 for calling a global function with example usage: as_ivy_dtype() and returns: ivy, ivy, ivy, ivy, ivy, as_ivy_dtype, ivy, ivy, ivy, ivy