code: def _list_indexing(X, key, key_dtype):
      """Index a Python list"""
      if np.isscalar(key) or isinstance(key, slice):
          # key is a slice or a scalar
          return X[key]
      if key_dtype == "bool":
          # key is a boolean array-like
          return list(compress(X, key))
      # key is a integer array-like of key
      return [X[idx] for idx in key]
  
imports: import numbers
  import numpy
  from itertools import compress
  from scipy.sparse import issparse
  from sklearn.model_selection import ParameterGrid
  from sklearn.utils.validation import check_is_fitted
label_desc: Use image node_id 14 for calling a global function with example usage: _list_indexing(X, key, key_dtype) and returns: unknown, X, list