import math


def get_parts(partitions, num):
    """
    Divide a number of partitions over a number of sources,
    With the last source having possibly fewer items.
    """
    parts = []
    size = int(math.ceil(partitions/float(num)))
    for x in range(num):
        parts.append([])
        for v in range(size*x, size*(x+1)):
            if v < partitions:
                parts[-1].append(v)
    return parts