<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_time_series(sdat, var, tstart, tend):
 """Extract or compute and rescale a time series. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`):
 a StagyyData instance. var (str):
 time series name, a key of :data:`stagpy.phyvars.TIME` or :data:`stagpy.phyvars.TIME_EXTRA`. tstart (float):
 starting time of desired series. Set to None to start at the beginning of available data. tend (float):
 ending time of desired series. Set to None to stop at the end of available data. Returns: tuple of :class:`numpy.array` and :class:`stagpy.phyvars.Vart`: series, time, meta series is the requested time series, time the time at which it is evaluated (set to None if it is the one of time series output by StagYY), and meta is a :class:`stagpy.phyvars.Vart` instance holding metadata of the requested variable. """

    tseries = sdat.tseries_between(tstart, tend)
    if var in tseries.columns:
        series = tseries[var]
        time = None
        if var in phyvars.TIME:
            meta = phyvars.TIME[var]
        else:
            meta = phyvars.Vart(var, None, '1')
    elif var in phyvars.TIME_EXTRA:
        meta = phyvars.TIME_EXTRA[var]
        series, time = meta.description(sdat, tstart, tend)
        meta = phyvars.Vart(misc.baredoc(meta.description),
                            meta.kind, meta.dim)
    else:
        raise UnknownTimeVarError(var)

    series, _ = sdat.scale(series, meta.dim)
    if time is not None:
        time, _ = sdat.scale(time, 's')
    return series, time, meta