code: def _sanity_check(fh):
      """
      Check if the file at least looks like AFM.
      If not, raise :exc:`RuntimeError`.
      """
  
      # Remember the file position in case the caller wants to
      # do something else with the file.
      pos = fh.tell()
      try:
          line = fh.readline()
      finally:
          fh.seek(pos, 0)
  
      # AFM spec, Section 4: The StartFontMetrics keyword [followed by a
      # version number] must be the first line in the file, and the
      # EndFontMetrics keyword must be the last non-empty line in the
      # file. We just check the first line.
      if not line.startswith("StartFontMetrics"):
          raise RuntimeError("Not an AFM file")
  
imports: import sys, os, re
  from _mathtext_data import uni2type1
label_desc: Use image node_id 4 for calling a global function with example usage: _sanity_check(fh) without return types