code: def _get_column_indices(X, key):
      """Get feature column indices for input data X and key."""
      n_columns = X.shape[1]
  
      key_dtype = _determine_key_type(key)
  
      if isinstance(key, (list, tuple)) and not key:
          # we get an empty list
          return []
      elif key_dtype in ("bool", "int"):
          # Convert key into positive indexes
          try:
              idx = _safe_indexing(np.arange(n_columns), key)
          except IndexError as e:
              raise ValueError(
                  "all features must be in [0, {}] or [-{}, 0]".format(
                      n_columns - 1, n_columns
                  )
              ) from e
          return np.atleast_1d(idx).tolist()
      elif key_dtype == "str":
          try:
              all_columns = X.columns
          except AttributeError:
              raise ValueError(
                  "Specifying the columns using strings is only "
                  "supported for pandas DataFrames"
              )
          if isinstance(key, str):
              columns = [key]
          elif isinstance(key, slice):
              start, stop = key.start, key.stop
              if start is not None:
                  start = all_columns.get_loc(start)
              if stop is not None:
                  # pandas indexing with strings is endpoint included
                  stop = all_columns.get_loc(stop) + 1
              else:
                  stop = n_columns + 1
              return list(range(n_columns)[slice(start, stop)])
          else:
              columns = list(key)
  
          try:
              column_indices = []
              for col in columns:
                  col_idx = all_columns.get_loc(col)
                  if not isinstance(col_idx, numbers.Integral):
                      raise ValueError(
                          f"Selected columns, {columns}, are not "
                          "unique in dataframe"
                      )
                  column_indices.append(col_idx)
  
          except KeyError as e:
              raise ValueError(
                  "A given column is not a column of the dataframe"
              ) from e
  
          return column_indices
      else:
          raise ValueError(
              "No valid specification of the columns. Only a "
              "scalar, list or slice of all integers or all "
              "strings, or boolean mask is allowed"
          )
  
imports: from ..preprocessing import FunctionTransformer
  from ....thirdparty_adapters import check_array
  from ..utils.validation import check_is_fitted
  from ..utils.skl_dependencies import TransformerMixin, BaseComposition, BaseEstimator
  from cuml.internals import _deprecate_pos_args
  from cuml.internals.array_sparse import SparseCumlArray
  from cuml.internals.global_settings import _global_settings_data
  import cuml
  from itertools import chain
  from itertools import compress
  from joblib import Parallel
  import functools
  import timeit
  import numbers
  from cuml.internals.import_utils import has_sklearn
  from contextlib import contextmanager
  from collections import defaultdict
  import warnings
  from cuml.internals.safe_imports import cpu_only_import_from
  from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.internals.safe_imports import cpu_only_import
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 3 for calling a global function with example usage: _get_column_indices(X, key) and returns: list, np, column_indices, list