itertools.product has a repeat parameter which is very handy. Last example uses it now.