def random_product(*args, **kwargs):
 repeat = kwargs.pop('repeat', 1)
 if (kwargs != {}):
  raise TypeError(('random_product() does not support argument %s' % kwargs.popitem()))
 pools = (map(tuple, args) * repeat)
 return tuple((random.choice(pool) for pool in pools))

def random_product ( * args , ** kwargs ) : repeat = kwargs . pop ( 'repeat' , 1 ) if ( kwargs != { } ) : raise TypeError ( ( 'random_product() does not support argument %s' % kwargs . popitem ( ) ) ) pools = ( map ( tuple , args ) * repeat ) return tuple ( ( random . choice ( pool ) for pool in pools ) )
random_product -> tuple arguments: args: one or more iterables repeat: number of times to repeat args .