code: def med_mentions_example_iterator(
      filename: str,
  ) -> Iterator[MedMentionExample]:
      """
      Iterates over a Med Mentions file, yielding examples.
      """
      with open(filename, "r", encoding="utf-8") as med_mentions_file:
          lines = []
          for line in med_mentions_file:
              line = line.strip()
              if line:
                  lines.append(line)
              else:
                  yield process_example(lines)
                  lines = []
          # Pick up stragglers
          if lines:
              yield process_example(lines)
  
file_path: scispacy/scispacy/data_util.py
imports: from typing import Optional, NamedTuple, List, Iterator, Dict, Tuple
  import tarfile
  import atexit
  import os
  import shutil
  import tempfile
  from scispacy.file_cache import cached_path
label_desc: Use image node_id 2 for calling a global function with example usage: med_mentions_example_iterator(filename) without return types