code: def _compatible_boolean_index(idx):
      """Returns a boolean index array that can be converted to
      integer array. Returns None if no such array exists.
      """
      # presence of attribute `ndim` indicates a compatible array type.
      if hasattr(idx, "ndim"):
          if idx.dtype.kind == "b":
              return idx
      # non-ndarray bool collection should be converted to ndarray
      elif _first_element_bool(idx):
          return cupy.asarray(idx, dtype="bool")
      return None
  
imports: import cupy
  from cupy import _core
  from cupyx.scipy.sparse._base import isspmatrix
  from cupyx.scipy.sparse._base import spmatrix
  from cupy.cuda import device
  from cupy.cuda import runtime
  import numpy
label_desc: Use image node_id 12 for calling a global function with example usage: _compatible_boolean_index(idx) and returns: None, idx, cupy