code: def check_sparse(
      array, accept_sparse=False, accept_large_sparse=True
  ):
      """Checks that the sparse array is valid
  
      Parameters
      ----------
      accept_sparse : string, boolean or list/tuple of strings (default=False)
          String[s] representing allowed sparse matrix formats, such as 'csc',
          'csr', etc. If the input is sparse but not in the allowed format,
          it will be converted to the first listed format. True allows the input
          to be any format. False means that a sparse matrix input will
          raise an error.
      accept_large_sparse : bool (default=True)
          If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by
          accept_sparse, accept_large_sparse=False will cause it to be accepted
          only if its indices are stored with a 32-bit dtype.
  
      Returns
      -------
      None or raise error
      """
      if accept_sparse is True:
          return
  
      err_msg = (
          "This algorithm does not support the sparse "
          + "input in the current configuration."
      )
  
      is_sparse = cpu_sparse.issparse(array) or gpu_sparse.issparse(
          array
      )
      if is_sparse:
          if accept_sparse is False:
              raise ValueError(err_msg)
  
          if not accept_large_sparse:
              if (
                  array.indices.dtype != cp.int32
                  or array.indptr.dtype != cp.int32
              ):
                  raise ValueError(err_msg)
  
          if isinstance(accept_sparse, (tuple, list)):
              if array.format not in accept_sparse:
                  raise ValueError(err_msg)
          elif array.format != accept_sparse:
              raise ValueError(err_msg)
  
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 1 for calling a global function with example usage: check_sparse(array, accept_sparse, accept_large_sparse) without return types