code: def _log_step_metrics(self, metrics: "StepMetrics"):
      if (metrics.name, tuple(metrics.groups)) in self._step_metrics:
          self._step_metrics[
              (metrics.name, tuple(metrics.groups))
          ] = self._step_metrics[
              (metrics.name, tuple(metrics.groups))
          ].merge(
              metrics
          )
      else:
          self._step_metrics[
              (metrics.name, tuple(metrics.groups))
          ] = metrics
  
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 2 for calling the InMemoryMetricsHandler obj's underlying member method code with example usage: obj._log_step_metrics(metrics) without return types