code: def _validate_experiment_and_get_optimization_config(
      experiment: Experiment,
      metric_names: Optional[Tuple[str, str]] = None,
      reference_point: Optional[Tuple[float, float]] = None,
      minimize: Optional[Union[bool, Tuple[bool, bool]]] = None,
  ) -> Optional[OptimizationConfig]:
      # If `optimization_config` is unspecified, check what inputs are missing and
      # error/warn accordingly
      if experiment.optimization_config is None:
          if metric_names is None:
              raise UserInputError(
                  "Inference of defaults failed. Please either specify `metric_names` "
                  "(and optionally `minimize` and `reference_point`) or provide an "
                  "experiment with an `optimization_config`."
              )
          if reference_point is None or minimize is None:
              warnings.warn(
                  "Inference of defaults failed. Please specify `minimize` and "
                  "`reference_point` if available, or provide an experiment with an "
                  "`optimization_config` that contains an `objective` and "
                  "`objective_threshold` corresponding to each of `metric_names`: "
                  f"{metric_names}."
              )
          return None
      return not_none(experiment.optimization_config)
  
imports: import warnings
  from typing import Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  import pandas
  import plotly.graph_objs
  from ax.core.experiment import Experiment
  from ax.core.objective import MultiObjective
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig, OptimizationConfig
  from ax.core.outcome_constraint import ObjectiveThreshold
  from ax.exceptions.core import UserInputError
  from ax.plot.base import AxPlotConfig, AxPlotTypes, CI_OPACITY, DECIMALS
  from ax.plot.color import COLORS, DISCRETE_COLOR_SCALE, rgba
  from ax.plot.helper import _format_CI, _format_dict, extend_range
  from ax.plot.pareto_utils import ParetoFrontierResults
  from ax.service.utils.best_point_mixin import BestPointMixin
  from ax.utils.common.typeutils import checked_cast, not_none
  from plotly import express
  from scipy.stats import norm
label_desc: Use image node_id 12 for calling a global function with example usage: _validate_experiment_and_get_optimization_config(experiment, metric_names, reference_point, minimize) and returns: not_none, None