def chunks(xs, n):
    """
    Split list to evenly sized chunks

    >> chunks(range(10), 4)
    [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9]]

    :param xs: arbitrary list
    :param n: chunk size
    :return: list of lists
    """
    return [xs[i : i + n] for i in range(0, len(xs), n)]