import math


def chunk(iterable, n):
    """Splits a list into n equal parts"""
    iterable = [e for e in iterable]
    avg_length = int(math.ceil(len(iterable) / n))
    return [iterable[i * avg_length:(i + 1) * avg_length] for i in range(n)]