def split_by(array, group_size, filler):
 args = ([iter(array)] * group_size)
 return list(map(list, zip_longest(fillvalue=filler, *args)))

def split_by ( array , group_size , filler ) : args = ( [ iter ( array ) ] * group_size ) return list ( map ( list , zip_longest ( fillvalue = filler , * args ) ) )
group elements into list of size group_size and fill empty cells with filler .