I wrote a small utility function that divides a total into n parts in the ratio given in load_list. Numbers in each part should be positive integers. It supports an optional min_num argument that, when specified, puts at least min_num in each of the n parts before distributing the rest.  Please review.def reduce_ratio(load_list, total_num, min_num=1):    Returns the distribution of `total_num` in the ratio of `load_list` in the best possible way  `min_num` gives the minimum per entry  >>> reduce_ratio([5, 10, 15], 12)  [2, 4, 6]  >>> reduce_ratio([7, 13, 30], 6, 0)  [1, 2, 3]  >>> reduce_ratio([7, 13, 50], 6)  [1, 1, 4]  >>> reduce_ratio([7, 13, 50], 6, 3)  Traceback (most recent call last):    ...  ValueError: Could not satisfy min_num  >>> reduce_ratio([7, 13, 50], 100, 15)  [15, 18, 67]  >>> reduce_ratio([7, 13, 50], 100)  [10, 19, 71]    num_loads = [ [load, min_num] for  load in load_list ]  yet_to_split = total_num - ( len(num_loads) * min_num )  if yet_to_split < 0:    raise ValueError('Could not satisfy min_num')  for _ in range(yet_to_split):    min_elem = min(num_loads, key=lambda (load, count): (float(count)/load, load))    min_elem[1] += 1  reduced_loads = map(itemgetter(1), num_loads)  if sum(reduced_loads) != total_num:    raise Exception('Could not split loads to required total')  return reduced_loads
Utility function to split a number into n parts in the given ratio
python