code: def _get_column_indices(X, key):
      """Get feature column indices for input data X and key.
  
      For accepted values of `key`, see the docstring of
      :func:`_safe_indexing`.
      """
      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(islice(range(n_columns), 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: import math
  import numbers
  import platform
  import struct
  import timeit
  import warnings
  from collections.abc import Sequence
  from contextlib import contextmanager, suppress
  from itertools import compress, islice
  import numpy
  from scipy.sparse import issparse
  from ..None import get_config
  from ..exceptions import DataConversionWarning
  from .None import _joblib, metadata_routing
  from ._bunch import Bunch
  from ._estimator_html_repr import estimator_html_repr
  from ._param_validation import Interval, validate_params
  from .class_weight import compute_class_weight, compute_sample_weight
  from .deprecation import deprecated
  from .discovery import all_estimators
  from .fixes import parse_version, threadpool_info
  from .murmurhash import murmurhash3_32
  from .validation import _is_arraylike_not_scalar, as_float_array, assert_all_finite, check_array, check_consistent_length, check_random_state, check_scalar, check_symmetric, check_X_y, column_or_1d, indexable
label_desc: Use image node_id 10 for calling a global function with example usage: _get_column_indices(X, key) and returns: list, np, column_indices, list