human
I wrote the below code

    import warnings
    warnings.warn('Old    ADVI    interface    and    sample_vp    is    deprecated    and    will    be    removed    in    future,    use    pm.fit    and    pm.sample_approx    instead', DeprecationWarning, stacklevel=2)
    model = pm.modelcontext(model)
    if isinstance(vparams, ADVIFit):
        vparams = {'means': vparams.means, 'stds': vparams.stds}
    ds = model.deterministics
    def get_transformed(v):
        return (v if (v not in ds) else v.transformed)
    def rvs(x):
        return ([get_transformed(v) for v in x] if (x is not None) else [])
    global_RVs = list((set(model.free_RVs) - set(rvs(local_RVs))))
    if (random_seed is None):
        r = MRG_RandomStreams(gen_random_state())
    else:
        r = MRG_RandomStreams(seed=random_seed)
    updates = {}
    for v in global_RVs:
        u = theano.shared(vparams['means'][str(v)]).ravel()
        w = theano.shared(vparams['stds'][str(v)]).ravel()
        n = r.normal(size=u.tag.test_value.shape)
        updates.update({v: ((n * w) + u).reshape(v.tag.test_value.shape)})
    if (local_RVs is not None):
        for (v_, (uw, _)) in local_RVs.items():
            v = get_transformed(v_)
            u = uw[0].ravel()
            w = uw[1].ravel()
            n = r.normal(size=u.tag.test_value.shape)
            updates.update({v: ((n * tt.exp(w)) + u).reshape(v.tag.test_value.shape)})
    vars = model.free_RVs
    samples = theano.clone(vars, updates)
    f = theano.function([], samples)
    vars_sampled = pm.util.get_default_varnames(model.unobserved_RVs, include_transformed=include_transformed)
    varnames = [str(var) for var in model.unobserved_RVs]
    trace = pm.sampling.NDArray(model=model, vars=vars_sampled)
    trace.setup(draws=draws, chain=0)
    range_ = (trange(draws) if progressbar else range(draws))
    for _ in range_:
        point = {varname: value for (varname, value) in zip(varnames, f())}
        trace.record(point)
    return MultiTrace([trace])

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

def sample_vp(vparams, draws=1000, model=None, local_RVs=None, random_seed=None, include_transformed=False, progressbar=True):