code: def _sample_ice(
      ice_values: np.ndarray,
      n_ice: Union[Literal["all"], int, List[int]],
  ) -> np.ndarray:
      """
      Samples `ice_values` based on the `n_ice` argument.
  
      Parameters
      ----------
      ice_values
          Array of ice_values of dimension `V x N`, where `V` is the number of feature values where the PD is computed,
          and `N` is the number of instances in the reference dataset.
      n_ice
          See :py:meth:`alibi.explainers.partial_dependence.plot_pd`.
      """
      if n_ice == "all":
          return ice_values
  
      _, N = ice_values.shape
      if isinstance(n_ice, numbers.Integral):
          if n_ice >= N:
              logger.warning(
                  "`n_ice` is greater than the number of instances in the reference dataset. "
                  "Automatically setting `n_ice` to the number of instances in the reference dataset."
              )
              return ice_values
  
          if n_ice <= 0:
              raise ValueError(
                  "`n_ice` must be an integer grater than 0."
              )
  
          indices = np.random.choice(a=N, size=n_ice, replace=False)
          return ice_values[:, indices]
  
      if isinstance(n_ice, list):
          n_ice = np.unique(n_ice)  # type: ignore[assignment]
          if not np.all(n_ice < N) or not np.all(n_ice >= 0):  # type: ignore[operator]
              raise ValueError(
                  f"Some indices in `n_ice` are out of bounds. Ensure that all indices are "
                  f"greater or equal than 0 and less than {N}."
              )
          return ice_values[:, n_ice]
  
      raise ValueError(
          f"Unknown `n_ice` values. `n_ice` can be a string taking value 'all', "
          f"an integer, or a list of integers. Received {n_ice}."
      )
  
imports: import copy
  import logging
  import math
  import numbers
  import sys
  from abc import ABC, abstractmethod
  from enum import Enum
  from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union, no_type_check
  import matplotlib.pyplot
  import numpy
  from scipy.stats.mstats import mquantiles
  from sklearn.base import BaseEstimator, is_classifier, is_regressor
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.ensemble._gb import BaseGradientBoosting
  from sklearn.ensemble._hist_gradient_boosting.gradient_boosting import BaseHistGradientBoosting
  from sklearn.tree import DecisionTreeRegressor
  from sklearn.utils.extmath import cartesian
  from sklearn.utils.validation import check_is_fitted
  from tqdm import tqdm
  from alibi.api.defaults import DEFAULT_DATA_PD, DEFAULT_META_PD
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.explainers.ale import get_quantiles
  from alibi.utils import _get_options_string
label_desc: Use image node_id 2 for calling a global function with example usage: _sample_ice(ice_values, n_ice) and returns: ice_values, ice_values, ice_values, ice_values