code: def get_subset_datasets(
      datasets: List[SupervisedDataset],
      subset_metric_names: List[str],
  ) -> List[SupervisedDataset]:
      """Get the list of datasets corresponding to the given subset of
      metric names. This is used to separate out datasets that are
      used by one surrogate.
  
      Args:
          datasets: A list of `SupervisedDataset` objects.
          subset_metric_names: A list of metric names to get datasets for.
  
      Returns:
          A list of `SupervisedDataset` objects corresponding to the given
          subset of metric names.
      """
      check_metric_dataset_match(
          metric_names=subset_metric_names,
          datasets=datasets,
          exact_match=False,
      )
      single_outcome_datasets = {
          ds.outcome_names[0]: ds
          for ds in datasets
          if len(ds.outcome_names) == 1
      }
      multi_outcome_datasets = {
          tuple(ds.outcome_names): ds
          for ds in datasets
          if len(ds.outcome_names) > 1
      }
      subset_datasets = []
      metrics_processed = []
      for metric_name in subset_metric_names:
          if metric_name in metrics_processed:
              # This can happen if the metric appears in a multi-outcome
              # dataset that is already processed.
              continue
          if metric_name in single_outcome_datasets:
              # The default case of metric with a corresponding dataset.
              ds = single_outcome_datasets[metric_name]
          else:
              # The case of metric being part of a multi-outcome dataset.
              for outcome_names in multi_outcome_datasets.keys():
                  if metric_name in outcome_names:
                      ds = multi_outcome_datasets[outcome_names]
                      if not set(ds.outcome_names).issubset(
                          subset_metric_names
                      ):
                          raise UnsupportedError(
                              "Breaking up a multi-outcome dataset between "
                              "surrogates is not supported."
                          )
                      break
          # Pyre-ignore [61]: `ds` may not be defined but it is guaranteed to be defined.
          subset_datasets.append(ds)
          metrics_processed.extend(ds.outcome_names)
      return subset_datasets
  
imports: import warnings
  from logging import Logger
  from typing import Any, Callable, Dict, List, Optional, OrderedDict, Tuple, Type
  import torch
  from ax.core.search_space import SearchSpaceDigest
  from ax.exceptions.core import AxError, AxWarning, UnsupportedError
  from ax.models.types import TConfig
  from ax.utils.common.constants import Keys
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import checked_cast, not_none
  from botorch.acquisition.acquisition import AcquisitionFunction
  from botorch.acquisition.logei import qLogNoisyExpectedImprovement
  from botorch.acquisition.multi_objective.logei import qLogNoisyExpectedHypervolumeImprovement
  from botorch.fit import fit_fully_bayesian_model_nuts, fit_gpytorch_mll
  from botorch.models.fully_bayesian import SaasFullyBayesianSingleTaskGP
  from botorch.models.gp_regression import SingleTaskGP
  from botorch.models.gp_regression_fidelity import SingleTaskMultiFidelityGP
  from botorch.models.gp_regression_mixed import MixedSingleTaskGP
  from botorch.models.gpytorch import BatchedMultiOutputGPyTorchModel, GPyTorchModel
  from botorch.models.model import Model, ModelList
  from botorch.models.multitask import MultiTaskGP
  from botorch.models.pairwise_gp import PairwiseGP
  from botorch.utils.datasets import SupervisedDataset
  from botorch.utils.transforms import is_fully_bayesian
  from gpytorch.mlls.marginal_log_likelihood import MarginalLogLikelihood
  from torch import Tensor
label_desc: Use image node_id 11 for calling a global function with example usage: get_subset_datasets(datasets, subset_metric_names) and returns: subset_datasets