code: def dump_sv(stream, metrics, delimiter=",", header=True):
      if header:
          writer = csv.DictWriter(
              stream,
              fieldnames=list(first(metrics).keys()),
              delimiter=delimiter,
          )
          writer.writeheader()
          writer.writerows(metrics)
      else:
          writer = csv.writer(stream)
          for d in metrics:
              writer.writerow(list(d.values()))
  
file_path: dvc/tests/utils/__init__.py
imports: import csv
  import os
  from contextlib import contextmanager
  import pytest
  from funcy import first
  from dvc.scm import Git
label_desc: Use image node_id 4 for calling a global function with example usage: dump_sv(stream, metrics, delimiter, header) without return types