def partition(length, parts):
    """Partitions 'length' into (approximately) equal 'parts'."""
    sublengths = [length//parts] * parts
    for i in range(length % parts):  # treatment of remainder
        sublengths[i] += 1
    return sublengths