code: def _get_safe_casting_dtype(draw, *, dtypes):
      target_dtype = dtypes[0]
      for dtype in dtypes[1:]:
          if np_frontend.can_cast(target_dtype, dtype, casting="safe"):
              target_dtype = dtype
      with BackendHandler.update_backend(
          test_globals.CURRENT_BACKEND
      ) as ivy_backend:
          if ivy_backend.is_float_dtype(target_dtype):
              dtype = draw(st.sampled_from(["float64", None]))
          elif ivy_backend.is_uint_dtype(target_dtype):
              dtype = draw(st.sampled_from(["uint64", None]))
          elif ivy_backend.is_int_dtype(target_dtype):
              dtype = draw(st.sampled_from(["int64", None]))
          elif ivy_backend.is_complex_dtype(target_dtype):
              dtype = draw(st.sampled_from(["complex128", None]))
          else:
              dtype = draw(st.sampled_from(["bool", None]))
          # filter uint64 as not supported by torch backend
          if dtype == "uint64":
              dtype = None
          return dtype
  
file_path: ivy/ivy_tests/test_ivy/test_frontends/test_numpy/helpers.py
imports: import numpy
  from hypothesis import strategies
  import ivy
  import ivy_tests.test_ivy.helpers
  import ivy.functional.frontends.numpy
  from ivy_tests.test_ivy.helpers.pipeline_helper import BackendHandler, get_frontend_config
  import ivy_tests.test_ivy.helpers.globals
label_desc: Use image node_id 5 for calling a global function with example usage: _get_safe_casting_dtype(draw) and returns: dtype