code: def fetch_trial_data(
      self, trial: BaseTrial, **kwargs
  ) -> MetricFetchResult:
      try:
          prediction = [
              trial.run_metadata[self.name][name]
              for name, arm in trial.arms_by_name.items()
          ]
          df = pd.DataFrame(
              {
                  "arm_name": [
                      name for name, _ in trial.arms_by_name.items()
                  ],
                  "metric_name": self.name,
                  "mean": prediction,
                  "sem": None if self.infer_noise else 0,
                  "trial_index": trial.index,
              }
          )
  
          return Ok(value=Data(df=df))
  
      except Exception as e:
          return Err(
              MetricFetchE(
                  message=f"Failed to predict for trial {trial}",
                  exception=e,
              )
          )
  
imports: from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple
  import pandas
  import torch
  from ax.benchmark.benchmark_problem import BenchmarkProblemBase
  from ax.core.base_trial import BaseTrial, TrialStatus
  from ax.core.data import Data
  from ax.core.metric import Metric, MetricFetchE, MetricFetchResult
  from ax.core.observation import ObservationFeatures
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig, OptimizationConfig
  from ax.core.parameter import RangeParameter
  from ax.core.runner import Runner
  from ax.core.search_space import SearchSpace
  from ax.core.types import TParameterization
  from ax.modelbridge.transforms.int_to_float import IntToFloat
  from ax.modelbridge.transforms.log import Log
  from ax.models.torch.botorch_modular.surrogate import Surrogate
  from ax.utils.common.base import Base
  from ax.utils.common.equality import equality_typechecker
  from ax.utils.common.result import Err, Ok
  from ax.utils.common.serialization import TClassDecoderRegistry, TDecoderRegistry
  from ax.utils.common.typeutils import not_none
  from botorch.utils.datasets import SupervisedDataset
label_desc: Use image node_id 2 for calling the SurrogateMetric obj's underlying member method code with example usage: obj.fetch_trial_data(trial) and returns: Ok, Err