<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def plot_average(sdat, lovs):
 """Plot time averaged profiles. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`):
 a StagyyData instance. lovs (nested list of str):
 nested list of profile names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: conf.core.snapshots: the slice of snapshots. conf.conf.timesteps: the slice of timesteps. """

    steps_iter = iter(sdat.walk.filter(rprof=True))
    try:
        step = next(steps_iter)
    except StopIteration:
        return

    sovs = misc.set_of_vars(lovs)

    istart = step.istep
    nprofs = 1
    rprof_averaged = {}
    rads = {}
    metas = {}

    # assume constant z spacing for the moment
    for rvar in sovs:
        rprof_averaged[rvar], rad, metas[rvar] = get_rprof(step, rvar)
        if rad is not None:
            rads[rvar] = rad

    for step in steps_iter:
        nprofs += 1
        for rvar in sovs:
            rprof_averaged[rvar] += get_rprof(step, rvar)[0]

    ilast = step.istep
    for rvar in sovs:
        rprof_averaged[rvar] /= nprofs
    rcmb, rsurf = misc.get_rbounds(step)
    rprof_averaged['bounds'] = (step.sdat.scale(rcmb, 'm')[0],
                                step.sdat.scale(rsurf, 'm')[0])
    rprof_averaged['r'] = get_rprof(step, 'r')[0] + rprof_averaged['bounds'][0]

    stepstr = '{}_{}'.format(istart, ilast)

    _plot_rprof_list(sdat, lovs, rprof_averaged, metas, stepstr, rads)