human
I wrote the below code

    gens2idx = {}
    for (i, g) in enumerate(gens):
        gens2idx[g] = i
    order = []
    for expr in arg:
        name = expr[0]
        var = expr[1:]
        def makelambda(var):
            return _ItemGetter((gens2idx[g] for g in var))
        order.append((monomial_key(name), makelambda(var)))
    return ProductOrder(*order)

What's a good function header?
assistant
#Here's a good function header.

def build_product_order(arg, gens):