code: def extract_pending_observations(
      experiment: Experiment,
      include_out_of_design_points: bool = False,
  ) -> Optional[Dict[str, List[ObservationFeatures]]]:
      """Computes a list of pending observation features (corresponding to:
      - arms that have been generated and run in the course of the experiment,
      but have not been completed with data,
      - arms that have been abandoned or belong to abandoned trials).
  
      This function dispatches to:
      - ``get_pending_observation_features`` if experiment is using
      ``BatchTrial``-s or has fewer than 100 trials,
      - ``get_pending_observation_features_based_on_trial_status`` if
      experiment is using  ``Trial``-s and has more than 100 trials.
  
      ``get_pending_observation_features_based_on_trial_status`` is a faster
      way to compute pending observations, but it is not guaranteed to be
      accurate for ``BatchTrial`` settings and makes assumptions, e.g.
      arms in ``COMPLETED`` trial never being pending. See docstring of
      that function for more details.
  
      NOTE: Pending observation features are passed to the model to
      instruct it to not generate the same points again.
      """
      if len(experiment.trials) >= MANY_TRIALS_IN_EXPERIMENT and all(
          isinstance(t, Trial) for t in experiment.trials.values()
      ):
          return get_pending_observation_features_based_on_trial_status(
              experiment=experiment,
              include_out_of_design_points=include_out_of_design_points,
          )
  
      return get_pending_observation_features(
          experiment=experiment,
          include_out_of_design_points=include_out_of_design_points,
      )
  
imports: from collections import defaultdict
  from typing import Dict, Iterable, List, NamedTuple, Optional, Set, Tuple
  import numpy
  from ax.core.arm import Arm
  from ax.core.base_trial import BaseTrial, TrialStatus
  from ax.core.batch_trial import BatchTrial
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.generator_run import GeneratorRun
  from ax.core.objective import MultiObjective
  from ax.core.observation import ObservationFeatures
  from ax.core.optimization_config import OptimizationConfig
  from ax.core.trial import Trial
  from ax.core.types import ComparisonOp
  from ax.utils.common.typeutils import not_none
  from pyre_extensions import none_throws
label_desc: Use image node_id 8 for calling a global function with example usage: extract_pending_observations(experiment, include_out_of_design_points) and returns: get_pending_observation_features, get_pending_observation_features_based_on_trial_status