code: def main(args=None):
      """Optimize a font's GDEF variation store"""
      from argparse import ArgumentParser
      from fontTools import configLogger
      from fontTools.ttLib import TTFont
      from fontTools.ttLib.tables.otBase import OTTableWriter
  
      parser = ArgumentParser(
          prog="varLib.varStore", description=main.__doc__
      )
      parser.add_argument("--quantization", type=int, default=1)
      parser.add_argument("fontfile")
      parser.add_argument("outfile", nargs="?")
      options = parser.parse_args(args)
  
      # TODO: allow user to configure logging via command-line options
      configLogger(level="INFO")
  
      quantization = options.quantization
      fontfile = options.fontfile
      outfile = options.outfile
  
      font = TTFont(fontfile)
      gdef = font["GDEF"]
      store = gdef.table.VarStore
  
      writer = OTTableWriter()
      store.compile(writer, font)
      size = len(writer.getAllData())
      print("Before: %7d bytes" % size)
  
      varidx_map = store.optimize(quantization=quantization)
  
      writer = OTTableWriter()
      store.compile(writer, font)
      size = len(writer.getAllData())
      print("After:  %7d bytes" % size)
  
      if outfile is not None:
          gdef.table.remap_device_varidxes(varidx_map)
          if "GPOS" in font:
              font["GPOS"].table.remap_device_varidxes(varidx_map)
  
          font.save(outfile)
  
imports: from fontTools.misc.roundTools import noRound, otRound
  from fontTools.misc.intTools import bit_count
  from fontTools.ttLib.tables import otTables
  from fontTools.varLib.models import supportScalar
  from fontTools.varLib.builder import buildVarRegionList, buildVarStore, buildVarRegion, buildVarData
  from functools import partial
  from collections import defaultdict
  from heapq import heappush, heappop
label_desc: Use image node_id 13 for calling a global function with example usage: main(args) without return types