code: def _read_mff_events(filename, sfreq):
      """Extract the events.
  
      Parameters
      ----------
      filename : path-like
          File path.
      sfreq : float
          The sampling frequency
      """
      orig = {}
      for xml_file in glob(join(filename, "*.xml")):
          xml_type = splitext(basename(xml_file))[0]
          orig[xml_type] = _parse_xml(xml_file)
      xml_files = orig.keys()
      xml_events = [x for x in xml_files if x[:7] == "Events_"]
      for item in orig["info"]:
          if "recordTime" in item:
              start_time = _ns2py_time(item["recordTime"])
              break
      markers = []
      code = []
      for xml in xml_events:
          for event in orig[xml][2:]:
              event_start = _ns2py_time(event["beginTime"])
              start = (event_start - start_time).total_seconds()
              if event["code"] not in code:
                  code.append(event["code"])
              marker = {
                  "name": event["code"],
                  "start": start,
                  "start_sample": int(np.fix(start * sfreq)),
                  "end": start + float(event["duration"]) / 1e9,
                  "chan": None,
              }
              markers.append(marker)
      events_tims = dict()
      for ev in code:
          trig_samp = list(
              c["start_sample"]
              for n, c in enumerate(markers)
              if c["name"] == ev
          )
          events_tims.update({ev: trig_samp})
      return events_tims, code
  
file_path: mne-python/mne/io/egi/events.py
imports: from datetime import datetime
  from glob import glob
  from os.path import basename, join, splitext
  import numpy
  from ...utils import _soft_import, logger
label_desc: Use image node_id 2 for calling a global function with example usage: _read_mff_events(filename, sfreq) and returns: events_tims,  code