def split(l, n):
    """
        Split a list in n parts
    """
    if l is None:
        return []
    avg = len(l) / float(n)
    out = []
    last = 0.0
    while last < len(l):
        out.append(l[int(last):int(last + avg)])
        last += avg
    return out
    # return [l[i::n] for i in range(n)] # This doesn't keep the order