if len(l) == 1:
    return l[0]
else:
    lnew = []
for a in l[0]:
    for b in permutenew(l[1:]):
        lnew.append(a + b)
return lnew
l = [['a', 'b', 'c'], ['a', 'b'], ['g', 'h', 'r', 'w']]
print(permutenew(l))
Permutations of a list of lists