code: def log_metrics(
      self, metrics: Dict[str, float], step: Optional[int] = None
  ):
      assert (
          rank_zero_only.rank == 0
      ), "experiment tried to log from global_rank != 0"
  
      metric_items: Dict[str:Any] = {k: v for k, v in metrics.items()}
  
      if "epoch" in metric_items:
          epoch: int = metric_items.pop("epoch")
      else:
          epoch = None
  
      for k, v in metric_items.items():
          name = k
          context = {}
          if self._train_metric_prefix and name.startswith(
              self._train_metric_prefix
          ):
              name = name[len(self._train_metric_prefix) :]
              context["subset"] = "train"
          elif self._test_metric_prefix and name.startswith(
              self._test_metric_prefix
          ):
              name = name[len(self._test_metric_prefix) :]
              context["subset"] = "test"
          elif self._val_metric_prefix and name.startswith(
              self._val_metric_prefix
          ):
              name = name[len(self._val_metric_prefix) :]
              context["subset"] = "val"
          self.experiment.track(
              v, name=name, step=step, epoch=epoch, context=context
          )
  
file_path: aim/aim/sdk/adapters/pytorch_lightning.py
imports: import os
  from typing import Any, Dict, Optional, Union
  from argparse import Namespace
  import packaging.version
  from aim.sdk.run import Run
  from aim.sdk.repo import Repo
  from aim.sdk.utils import clean_repo_path, get_aim_repo_name
  from aim.ext.resource.configs import DEFAULT_SYSTEM_TRACKING_INT
label_desc: Use image node_id 5 for calling the AimLogger obj's underlying member method code with example usage: obj.log_metrics(metrics, step) without return types