def _product(*args, **kwds):
    """
    Generates cartesian product of lists given as arguments

    From itertools.product documentation
    """

    pools = map(tuple, args) * kwds.get('repeat', 1)
    result = [[]]
    for pool in pools:
        result = [x+[y] for x in result for y in pool]
    return result
def _product ( * args , ** kwds ) : pools = map ( tuple , args ) * kwds . get ( 'repeat' , 1 ) result = [ [ ] ] for pool in pools : result = [ x + [ y ] for x in result for y in pool ] return result
Generates cartesian product of lists given as arguments

    From itertools.product documentation