code: def glyphs2ufo(options):
      
      if options.output_dir is None:
          options.output_dir = os.path.dirname(options.glyphs_file) or "."
  
      if options.designspace_path is None:
          options.designspace_path = os.path.join(
              options.output_dir,
              os.path.basename(os.path.splitext(options.glyphs_file)[0]) + ".designspace",
          )
  
      # If options.instance_dir is None, instance UFO paths in the designspace
      # file will either use the value in customParameter's FULL_FILENAME_KEY or be
      # made relative to "instance_ufos/".
      glyphsLib.build_masters(
          options.glyphs_file,
          options.output_dir,
          options.instance_dir,
          designspace_path=options.designspace_path,
          minimize_glyphs_diffs=options.no_preserve_glyphsapp_metadata,
          propagate_anchors=options.propagate_anchors,
          normalize_ufos=options.normalize_ufos,
          create_background_layers=options.create_background_layers,
          generate_GDEF=options.generate_GDEF,
          store_editor_state=not options.no_store_editor_state,
      )
docs: Converts a Glyphs.app source file into UFO masters and a designspace file.