code: def VarStore_prune_regions(self):
      """Remove unused VarRegions."""
      #
      # Subset VarRegionList
      #
  
      # Collect.
      usedRegions = set()
      for data in self.VarData:
          usedRegions.update(data.VarRegionIndex)
      # Subset.
      regionList = self.VarRegionList
      regions = regionList.Region
      newRegions = []
      regionMap = {}
      for i in sorted(usedRegions):
          regionMap[i] = len(newRegions)
          newRegions.append(regions[i])
      regionList.Region = newRegions
      regionList.RegionCount = len(regionList.Region)
      # Map.
      for data in self.VarData:
          data.VarRegionIndex = [
              regionMap[i] for i in data.VarRegionIndex
          ]
  
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 6 for calling a global function with example usage: VarStore_prune_regions() without return types