code: def get_castable_dtype(
      draw, available_dtypes, dtype: str, x: Optional[list] = None
  ):
      """Draws castable dtypes for the given dtype based on the current backend.
  
      Parameters
      ----------
      draw
          Special function that draws data randomly (but is reproducible) from a given
          data-set (ex. list).
      available_dtypes
          Castable data types are drawn from this list randomly.
      dtype
          Data type from which to cast.
      x
          Optional list of values to cast.
  
      Returns
      -------
      ret
          A tuple of inputs and castable dtype.
      """
      cast_dtype = draw(
          st.sampled_from(available_dtypes).filter(
              lambda value: cast_filter(value, dtype=dtype, x=x)
          )
      )
      if x is None:
          return dtype, cast_dtype
      return dtype, x, cast_dtype
  
file_path: ivy/ivy_tests/test_ivy/helpers/hypothesis_helpers/dtype_helpers.py
imports: import numpy
  from hypothesis import strategies
  from typing import Optional
  import ivy
  from ..pipeline_helper import BackendHandler, get_frontend_config
  from .None import number_helpers
  from .None import array_helpers
  from ..None import globals
  from ..globals import mod_backend
label_desc: Use image node_id 6 for calling a global function with example usage: get_castable_dtype(draw, available_dtypes, dtype, x) and returns: dtype,  x,  cast_dtype, dtype,  cast_dtype