code: def to_record(self) -> "MetricRecord":
      return MetricRecord(
          name=self.name,
          type=self.type,
          groups=[
              MetricRecord.Group(name=g[0], index=g[1])
              for g in self.groups
          ],
          step_axis=self.step_axis,
          data=self.data,
      )
  
imports: import time
  import typing
  from typing import Dict, List, Optional, Tuple, Union
  import pydantic
  from ._namespace import NS, IndexedNS
label_desc: Use image node_id 4 for calling the StepMetrics obj's underlying member method code with example usage: obj.to_record() and returns: MetricRecord