def chunks(l, n):
    """Partitions the list l into disjoint sub-lists of length n."""
    if len(l) % n != 0:
        raise Exception('List length is not a multiple on %s', n)
    return [l[i:i+n] for i in range(0, len(l), n)]