code: def test_add_prefix():
      """Verify add_prefix modifies the dict keys correctly."""
      metrics = {"metric1": 1, "metric2": 2}
      metrics = _add_prefix(metrics, "prefix", "-")
  
      assert "prefix-metric1" in metrics
      assert "prefix-metric2" in metrics
      assert "metric1" not in metrics
      assert "metric2" not in metrics
  
      metrics = _add_prefix(metrics, "prefix2", "_")
  
      assert "prefix2_prefix-metric1" in metrics
      assert "prefix2_prefix-metric2" in metrics
      assert "prefix-metric1" not in metrics
      assert "prefix-metric2" not in metrics
      assert metrics["prefix2_prefix-metric1"] == 1
      assert metrics["prefix2_prefix-metric2"] == 2
  
file_path: pytorch-lightning/tests/tests_fabric/utilities/test_logger.py
imports: from argparse import Namespace
  from dataclasses import dataclass
  import numpy
  import torch
  from lightning.fabric.utilities.logger import _add_prefix, _convert_params, _flatten_dict, _sanitize_callable_params, _sanitize_params
label_desc: Use image node_id 5 for calling a global function with example usage: test_add_prefix() without return types