code: def grouped_count_sizes(fileslist, fgrouped):  # pragma: no cover
      '''Compute the total size per group and total number of files. Useful to check that everything is OK.'''
      fsizes = {}
      total_files = 0
      allitems = None
      if isinstance(fgrouped, dict):
          allitems = fgrouped.iteritems()
      elif isinstance(fgrouped, list):
          allitems = enumerate(fgrouped)
      for fkey, cluster in allitems:
          fsizes[fkey] = []
          for subcluster in cluster:
              tot = 0
              if subcluster is not None:
                  for fname in subcluster:
                      tot += fileslist[fname]
                      total_files += 1
              fsizes[fkey].append(tot)
      return fsizes, total_filef grouped_count_sizes(fileslist, fgrouped):  # pragma: no cover
      '''Compute the total size per group and total number of files. Useful to check that everything is OK.'''
      fsizes = {}
      total_files = 0
      allitems = None
      if isinstance(fgrouped, dict):
          allitems = fgrouped.iteritems()
      elif isinstance(fgrouped, list):
          allitems = enumerate(fgrouped)
      for fkey, cluster in allitems:
          fsizes[fkey] = []
          for subcluster in cluster:
              tot = 0
              if subcluster is not None:
                  for fname in subcluster:
                      tot += fileslist[fname]
                      total_files += 1
              fsizes[fkey].append(tot)
      return fsizes, total_files
docs: Compute the total size per group and total number of files. Useful to check that everything is OK.