code: def get_data(
      observation_data: List[ObservationData],
      metric_names: Union[List[str], None] = None,
  ) -> Dict[str, List[float]]:
      """Extract all metrics if `metric_names` is None."""
      Ys = defaultdict(list)
      for obsd in observation_data:
          for i, m in enumerate(obsd.metric_names):
              if metric_names is None or m in metric_names:
                  Ys[m].append(obsd.means[i])
      return Ys
  
imports: from __future__ import annotations
  from collections import defaultdict
  from math import isnan
  from numbers import Number
  from typing import Any, Callable, Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  import numpy
  from ax.core.observation import Observation, ObservationData, ObservationFeatures
  from ax.core.optimization_config import OptimizationConfig
  from ax.core.parameter import Parameter
  from ax.core.parameter_constraint import ParameterConstraint
  from ax.core.search_space import RobustSearchSpace, SearchSpace
  from ax.modelbridge.transforms.derelativize import Derelativize
  from scipy.stats import norm
label_desc: Use image node_id 1 for calling a global function with example usage: get_data(observation_data, metric_names) and returns: Ys