code: def get_out_of_sample_best_point_acqf(
      model: Model,
      Xs: List[Tensor],
      X_observed: Tensor,
      objective_weights: Tensor,
      mc_samples: int = 512,
      fixed_features: Optional[Dict[int, float]] = None,
      fidelity_features: Optional[List[int]] = None,
      target_fidelities: Optional[Dict[int, float]] = None,
      outcome_constraints: Optional[Tuple[Tensor, Tensor]] = None,
      seed_inner: Optional[int] = None,
      qmc: bool = True,
      risk_measure: Optional[RiskMeasureMCObjective] = None,
      **kwargs: Any,
  ) -> Tuple[AcquisitionFunction, Optional[List[int]]]:
      """Picks an appropriate acquisition function to find the best
      out-of-sample (predicted by the given surrogate model) point
      and instantiates it.
  
      NOTE: Typically the appropriate function is the posterior mean,
      but can differ to account for fidelities etc.
      """
      model = model
  
      # subset model only to the outcomes we need for the optimization
      if kwargs.get(Keys.SUBSET_MODEL, True):
          subset_model_results = subset_model(
              model=model,
              objective_weights=objective_weights,
              outcome_constraints=outcome_constraints,
          )
          model = subset_model_results.model
          objective_weights = subset_model_results.objective_weights
          outcome_constraints = subset_model_results.outcome_constraints
  
      fixed_features = fixed_features or {}
      target_fidelities = target_fidelities or {}
  
      if fidelity_features:
          # we need to optimize at the target fidelities
          if any(f in fidelity_features for f in fixed_features):
              raise RuntimeError(
                  "Fixed features cannot also be fidelity features."
              )
          elif set(fidelity_features) != set(target_fidelities):
              raise RuntimeError(
                  "Must provide a target fidelity for every fidelity feature."
              )
          # make sure to not modify fixed_features in-place
          fixed_features = {**fixed_features, **target_fidelities}
      elif target_fidelities:
          raise RuntimeError(
              "Must specify fidelity_features in fit() when using target fidelities."
          )
  
      (
          acqf_class,
          acqf_options,
      ) = pick_best_out_of_sample_point_acqf_class(
          outcome_constraints=outcome_constraints,
          mc_samples=mc_samples,
          qmc=qmc,
          seed_inner=seed_inner,
          risk_measure=risk_measure,
      )
      (
          objective,
          posterior_transform,
      ) = get_botorch_objective_and_transform(
          botorch_acqf_class=acqf_class,
          model=model,
          objective_weights=objective_weights,
          outcome_constraints=outcome_constraints,
          X_observed=X_observed,
          risk_measure=risk_measure,
      )
  
      if objective is not None:
          if not isinstance(objective, MCAcquisitionObjective):
              raise UnsupportedError(
                  f"Unknown objective type: {objective.__class__}"  # pragma: nocover
              )
          acqf_options = {"objective": objective, **acqf_options}
      if posterior_transform is not None:
          acqf_options = {
              "posterior_transform": posterior_transform,
              **acqf_options,
          }
  
      acqf = acqf_class(model=model, **acqf_options)  # pyre-ignore [45]
  
      if fixed_features:
          acqf = FixedFeatureAcquisitionFunction(
              acq_function=acqf,
              d=X_observed.size(-1),
              columns=list(fixed_features.keys()),
              values=list(fixed_features.values()),
          )
          non_fixed_idcs = [
              i
              for i in range(Xs[0].size(-1))
              if i not in fixed_features
          ]
  
      else:
          non_fixed_idcs = None
  
      return acqf, non_fixed_idcs
  
imports: from dataclasses import dataclass
  from logging import Logger
  from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Type
  import numpy
  import torch
  from ax.exceptions.core import UnsupportedError
  from ax.exceptions.model import ModelError
  from ax.models.model_utils import filter_constraints_and_fixed_features, get_observed
  from ax.models.random.sobol import SobolGenerator
  from ax.models.types import TConfig
  from ax.utils.common.constants import Keys
  from ax.utils.common.logger import get_logger
  from botorch.acquisition.acquisition import AcquisitionFunction
  from botorch.acquisition.analytic import PosteriorMean
  from botorch.acquisition.fixed_feature import FixedFeatureAcquisitionFunction
  from botorch.acquisition.monte_carlo import qSimpleRegret, SampleReducingMCAcquisitionFunction
  from botorch.acquisition.multi_objective.analytic import MultiObjectiveAnalyticAcquisitionFunction
  from botorch.acquisition.multi_objective.monte_carlo import MultiObjectiveMCAcquisitionFunction
  from botorch.acquisition.multi_objective.multi_output_risk_measures import MARS, MultiOutputRiskMeasureMCObjective
  from botorch.acquisition.multi_objective.objective import IdentityMCMultiOutputObjective, WeightedMCMultiOutputObjective
  from botorch.acquisition.objective import ConstrainedMCObjective, GenericMCObjective, IdentityMCObjective, LinearMCObjective, MCAcquisitionObjective, PosteriorTransform, ScalarizedPosteriorTransform
  from botorch.acquisition.risk_measures import RiskMeasureMCObjective
  from botorch.acquisition.utils import get_infeasible_cost
  from botorch.models import ModelListGP, SingleTaskGP
  from botorch.models.model import Model
  from botorch.posteriors.fully_bayesian import GaussianMixturePosterior
  from botorch.posteriors.gpytorch import GPyTorchPosterior
  from botorch.posteriors.posterior_list import PosteriorList
  from botorch.sampling.normal import IIDNormalSampler, SobolQMCNormalSampler
  from botorch.utils.constraints import get_outcome_constraint_transforms
  from botorch.utils.datasets import SupervisedDataset
  from botorch.utils.objective import get_objective_weights_transform
  from botorch.utils.sampling import sample_hypersphere, sample_simplex
  from torch import Tensor
label_desc: Use image node_id 12 for calling a global function with example usage: get_out_of_sample_best_point_acqf(model, Xs, X_observed, objective_weights, mc_samples, fixed_features, fidelity_features, target_fidelities, outcome_constraints, seed_inner, qmc, risk_measure) and returns: acqf,  non_fixed_idcs