@register.filter
def partition(my_list, n):
    '''
    Partitions a list into sublists, each with n (or fewer) elements.
    my_list = [1,2,3,4,5]
    partion(my_list, 2) => [[1,2],[3,4],[5]]
    '''

    try:
        n = int(n)
        my_list = list(my_list)
    except __HOLE__:
        return [my_list]
    return [my_list[i:i+n] for i in range(0, len(my_list), n)]
dataset/ETHPy150Open jumoconnect/openjumo/jumodjango/etc/templatetags/tags.py/partition