code: def dummy_annotation_file(tmp_path_factory, ch_names, fmt):
      """Create csv file for testing."""
      if fmt == "csv":
          content = (
              "onset,duration,description\n"
              "2002-12-03 19:01:11.720100,1.0,AA\n"
              "2002-12-03 19:01:20.720100,2.425,BB"
          )
      elif fmt == "txt":
          content = (
              "# MNE-Annotations\n"
              "# orig_time : 2002-12-03 19:01:11.720100\n"
              "# onset, duration, description\n"
              "0, 1, AA \n"
              "9, 2.425, BB"
          )
      else:
          assert fmt == "fif"
          content = Annotations(
              [0, 9], [1, 2.425], ["AA", "BB"], orig_time=_ORIG_TIME
          )
  
      if ch_names:
          if isinstance(content, Annotations):
              # this is a bit of a hack but it works
              content.ch_names[:] = ((), ("MEG0111", "MEG2563"))
          else:
              content = content.splitlines()
              content[-3] += ",ch_names"
              content[-2] += ","
              content[-1] += ",MEG0111:MEG2563"
              content = "\n".join(content)
  
      fname = (
          tmp_path_factory.mktemp("data") / f"annotations-annot.{fmt}"
      )
      if isinstance(content, str):
          with open(fname, "w") as f:
              f.write(content)
      else:
          content.save(fname)
      return fname
  
imports: import sys
  from collections import OrderedDict
  from datetime import datetime, timedelta, timezone
  from itertools import repeat
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from pytest import approx
  import mne
  from mne import Annotations, Epochs, annotations_from_events, count_annotations, create_info, events_from_annotations, read_annotations
  from mne.annotations import _handle_meas_date, _read_annotations_txt_parse_header, _sync_onset
  from mne.datasets import testing
  from mne.io import RawArray, concatenate_raws, read_raw_fif
  from mne.utils import _dt_to_stamp, _raw_annot, _record_warnings, _stamp_to_dt, assert_and_remove_boundary_annot, catch_logging, check_version
label_desc: Use image node_id 23 for calling a global function with example usage: dummy_annotation_file(tmp_path_factory, ch_names, fmt) and returns: fname