docs: def apply_instance_data(designspace, include_filenames=None, Font=defcon.Font):
      """Open UFO instances referenced by designspace, apply Glyphs instance
      data if present, re-save UFOs and return updated UFO Font objects.
  
      Args:
          designspace: DesignSpaceDocument object or path (str or PathLike) to
              a designspace file.
          include_filenames: optional set of instance filenames (relative to
              the designspace path) to be included. By default all instaces are
              processed.
          Font: the class used to load the UFO (default: defcon.Font).
      Returns:
          List of opened and updated instance UFOs.
      """
      from fontTools.designspaceLib import DesignSpaceDocument
      from os.path import normcase, normpath
  
      if hasattr(designspace, "__fspath__"):
          designspace = designspace.__fspath__()
      if isinstance(designspace, basestring):
          designspace = DesignSpaceDocument.fromfile(designspace)
  
      basedir = os.path.dirname(designspace.path)
      instance_ufos = []
      if include_filenames is not None:
          include_filenames = {normcase(normpath(p)) for p in include_filenames}
  
      for designspace_instance in designspace.instances:
          fname = designspace_instance.filename
          assert fname is not None, "instance %r missing required filename" % getattr(
              designspace_instance, "name", designspace_instance
          )
          if include_filenames is not None:
              fname = normcase(normpath(fname))
              if fname not in include_filenames:
                  continue
  
          logger.debug("Applying instance data to %s", fname)
          # fontmake <= 1.4.0 compares the ufo paths returned from this function
          # to the keys of a dict of designspace locations that have been passed
          # through normpath (but not normcase). We do the same.
          ufo = Font(normpath(os.path.join(basedir, fname)))
  
          set_weight_class(ufo, designspace, designspace_instance)
          set_width_class(ufo, designspace, designspace_instance)
  
          glyphs_instance = InstanceDescriptorAsGSInstance(designspace_instance)
          to_ufo_custom_params(None, ufo, glyphs_instance)
          ufo.save()
          instance_ufos.append(ufo)
      return instance_ufos