human
I wrote the below code

    def _denorm(queries, thing):
        fields = []
        results = []
        for q in queries:
            r = Ql(q, thing)
            if (not r):
                r = [default]
            if isinstance(r[0], type({})):
                fields.append(sorted(r[0].keys()))
            else:
                fields.append([q])
            results.append(r)
        flist = list(flatten(*map(iter, fields)))
        prod = itertools.product(*results)
        for p in prod:
            U = dict()
            for (ii, thing) in enumerate(p):
                if isinstance(thing, type({})):
                    U.update(thing)
                else:
                    U[fields[ii][0]] = thing
            (yield U)
    return list(flatten(*[_denorm(queries, thing) for thing in iterable_of_things]))

What's a good function header?

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

def denorm(queries, iterable_of_things, default=None):