code: def _checkSubstitutionGlyphsExist(glyphNames, substitutions):
      referencedGlyphNames = set()
      for _, substitution in substitutions:
          referencedGlyphNames |= substitution.keys()
          referencedGlyphNames |= set(substitution.values())
      missing = referencedGlyphNames - glyphNames
      if missing:
          raise VarLibValidationError(
              "Missing glyphs are referenced in conditional substitution rules:"
              f" {', '.join(missing)}"
          )
  
imports: from fontTools.misc.dictTools import hashdict
  from fontTools.misc.intTools import bit_count
  from fontTools.ttLib import newTable
  from fontTools.ttLib.tables import otTables
  from fontTools.ttLib.ttVisitor import TTVisitor
  from fontTools.otlLib.builder import buildLookup, buildSingleSubstSubtable
  from collections import OrderedDict
  from .errors import VarLibError, VarLibValidationError
label_desc: Use image node_id 3 for calling a global function with example usage: _checkSubstitutionGlyphsExist(glyphNames, substitutions) without return types