human
I wrote the below code

    model = modelcontext(model)
    if (model is not None):
        vars = model.free_RVs
    elif (vars is None):
        vars = trace.varnames
    def flat_t(var):
        x = trace[str(var)]
        return x.reshape((x.shape[0], np.prod(x.shape[1:], dtype=int)))
    return np.cov(np.concatenate(list(map(flat_t, vars)), 1).T)

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

def trace_cov(trace, vars=None, model=None):