import itertools


def getAllListCombinations(a):
    #http://www.saltycrane.com/blog/2011/11/find-all-combinations-set-lists-itertoolsproduct/
    """ Nice code to get all combinations of lists like in the above example, where each element from each list is represented only once """
    list_len_db={}
    for x in a:
        list_len_db[len(x)]=[]
    if len(list_len_db)==1 and 1 in list_len_db:
        ### Just simply combine non-complex data
        r=[]
        for i in a:
            r.append(i[0])
        return [r]
    else:
        return list(itertools.product(*a))