code: def _group_by_equal_size(obj_list, tot_groups, threshold=pow(2, 32)):
      
      sorted_obj_list = sorted([(obj['size'], obj) for obj in obj_list], reverse=True)
      groups = [(random.random(), []) for _ in range(tot_groups)]
  
      if tot_groups <= 1:
          groups = _group_by_size_greedy(obj_list, tot_groups)
          return groups
      heapq.heapify(groups)
      for obj in sorted_obj_list:
          if obj[0] > threshold:
              heapq.heappush(groups, (obj[0], [obj[1]]))
          else:
              size, files = heapq.heappop(groups)
              size += obj[0]
              files.append(obj[1])
              heapq.heappush(groups, (size, files))
      groups = [group[1] for group in groups]
      return groups
docs: Partition a list of objects evenly and by file size
  
      Files are placed according to largest file in the smallest bucket. If the
      file is larger than the given threshold, then it is placed in a new bucket
      by itself.
      :param obj_list: a list of dict-like objects with a 'size' property
      :param tot_groups: number of partitions to split the data
      :param threshold: the maximum size of each bucket
      :return: a list of lists, one for each partition