<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def moving_statistic(values, statistic, size, start=0, stop=None, step=None, **kwargs):
 """Calculate a statistic in a moving window over `values`. Parameters values : array_like The data to summarise. statistic : function The statistic to compute within each window. size : int The window size (number of values). start : int, optional The index at which to start. stop : int, optional The index at which to stop. step : int, optional The distance between start positions of windows. If not given, defaults to the window size, i.e., non-overlapping windows. kwargs Additional keyword arguments are passed through to the `statistic` function. Returns ------- out : ndarray, shape (n_windows,) Examples -------- array([ 7, 24]) array([ 7, 13, 24]) """


    windows = index_windows(values, size, start, stop, step)

    # setup output
    out = np.array([statistic(values[i:j], **kwargs) for i, j in windows])

    return out