code: def check_dtype(array, dtypes="numeric"):
      """Checks that the input dtype is part of acceptable dtypes
  
      Parameters
      ----------
      array : object
          Input object to check / convert.
      dtype : string, type, list of types or None (default="numeric")
          Data type of result. If None, the dtype of the input is preserved.
          If "numeric", dtype is preserved unless array.dtype is object.
          If dtype is a list of types, conversion on the first type is only
          performed if the dtype of the input is not in the list.
  
      Returns
      -------
      dtype or raise error
      """
      if dtypes is None:
          if not isinstance(array, cuDataFrame):
              return array.dtype
          else:
              return array.dtypes.tolist()[0]
  
      if dtypes == "numeric":
          dtypes = numeric_types
  
      if isinstance(dtypes, (list, tuple)):
          # fp16 is not supported, so remove from the list of dtypes if present
          dtypes = [d for d in dtypes if d != np.float16]
  
          if not isinstance(array, (pdDataFrame, cuDataFrame)):
              if array.dtype not in dtypes:
                  return dtypes[0]
          elif any([dt not in dtypes for dt in array.dtypes.tolist()]):
              return dtypes[0]
  
          if not isinstance(array, (pdDataFrame, cuDataFrame)):
              return array.dtype
          else:
              return array.dtypes.tolist()[0]
      elif dtypes == np.float16:
          raise NotImplementedError("Float16 not supported by cuML")
      else:
          # Single dtype to convert to
          return dtypes
  
file_path: cuml/python/cuml/thirdparty_adapters/adapters.py
imports: from cupyx.scipy import sparse
  from scipy import sparse
  from scipy.sparse import csc_matrix
  from scipy.sparse import csc_matrix
  from cuml.internals.safe_imports import cpu_only_import_from
  from cupyx.scipy.sparse import csc_matrix
  from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.internals.global_settings import GlobalSettings
  from cuml.internals.input_utils import input_to_cupy_array, input_to_host_array
  from cuml.internals.safe_imports import gpu_only_import
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 2 for calling a global function with example usage: check_dtype(array, dtypes) and returns: array, array, array, array, dtypes, dtypes, dtypes