Here we can't replace the loops by `iteltools.product`. I have replaced the loops in the other two lines.