code: def _get_cv_plot_data(
      cv_results: List[CVResult], label_dict: Optional[Dict[str, str]]
  ) -> PlotData:
      if len(cv_results) == 0:
          return PlotData(
              metrics=[],
              in_sample={},
              out_of_sample=None,
              status_quo_name=None,
          )
  
      if label_dict is None:
          label_dict = {}
      # Apply label_dict to cv_results
      cv_results = deepcopy(cv_results)  # Copy and edit in-place
      for cv_i in cv_results:
          cv_i.observed.data.metric_names = [
              label_dict.get(m, m)
              for m in cv_i.observed.data.metric_names
          ]
          cv_i.predicted.metric_names = [
              label_dict.get(m, m) for m in cv_i.predicted.metric_names
          ]
  
      # arm_name -> Arm data
      insample_data: Dict[str, PlotInSampleArm] = {}
  
      # Get the union of all metric_names seen in predictions
      metric_names = list(
          set().union(
              *(
                  cv_result.predicted.metric_names
                  for cv_result in cv_results
              )
          )
      )
  
      for rid, cv_result in enumerate(cv_results):
          arm_name = cv_result.observed.arm_name
          arm_data = {
              "name": cv_result.observed.arm_name,
              "y": {},
              "se": {},
              "parameters": cv_result.observed.features.parameters,
              "y_hat": {},
              "se_hat": {},
              "context_stratum": None,
          }
          for i, mname in enumerate(
              cv_result.observed.data.metric_names
          ):
              # pyre-fixme[16]: Optional type has no attribute `__setitem__`.
              arm_data["y"][mname] = cv_result.observed.data.means[i]
              # pyre-fixme[16]: Item `None` of `Union[None, Dict[typing.Any,
              #  typing.Any], Dict[str, typing.Union[None, bool, float, int, str]], str]`
              #  has no attribute `__setitem__`.
              arm_data["se"][mname] = np.sqrt(
                  cv_result.observed.data.covariance[i][i]
              )
          for i, mname in enumerate(cv_result.predicted.metric_names):
              # pyre-fixme[16]: Item `None` of `Union[None, Dict[typing.Any,
              #  typing.Any], Dict[str, typing.Union[None, bool, float, int, str]], str]`
              #  has no attribute `__setitem__`.
              arm_data["y_hat"][mname] = cv_result.predicted.means[i]
              # pyre-fixme[16]: Item `None` of `Union[None, Dict[typing.Any,
              #  typing.Any], Dict[str, typing.Union[None, bool, float, int, str]], str]`
              #  has no attribute `__setitem__`.
              arm_data["se_hat"][mname] = np.sqrt(
                  cv_result.predicted.covariance[i][i]
              )
  
          # Expected `str` for 2nd anonymous parameter to call `dict.__setitem__` but got
          # `Optional[str]`.
          # pyre-fixme[6]:
          insample_data[f"{arm_name}_{rid}"] = PlotInSampleArm(
              **arm_data
          )
      return PlotData(
          metrics=metric_names,
          in_sample=insample_data,
          out_of_sample=None,
          status_quo_name=None,
      )
  
imports: from copy import deepcopy
  from typing import Any, Dict, List, Optional, Tuple
  import numpy
  import plotly.graph_objs
  from ax.core.batch_trial import BatchTrial
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.multi_type_experiment import MultiTypeExperiment
  from ax.core.observation import Observation
  from ax.modelbridge.cross_validation import CVResult
  from ax.modelbridge.transforms.convert_metric_names import convert_mt_observations
  from ax.plot.base import AxPlotConfig, AxPlotTypes, PlotData, PlotInSampleArm, PlotMetric, Z
  from ax.plot.helper import compose_annotation
  from ax.plot.scatter import _error_scatter_data, _error_scatter_trace
  from ax.utils.common.typeutils import not_none
  from plotly import subplots
label_desc: Use image node_id 5 for calling a global function with example usage: _get_cv_plot_data(cv_results, label_dict) and returns: PlotData, PlotData