code: def log_metrics(
      self, metrics: Union["StepMetrics", "OneTimeMetrics"]
  ):
      if isinstance(metrics, StepMetrics):
          self._log_step_metrics(metrics)
      elif isinstance(metrics, OneTimeMetrics):
          self._log_one_time_metrics(metrics)
      else:
          raise ValueError(f"metrics `{metrics}` not allowed")
  
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 1 for calling the BaseMetricsHandler obj's underlying member method code with example usage: obj.log_metrics(metrics) without return types