<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mean(data, n=3, **kwargs):
 """The mean forecast for the next point is the mean value of the previous ``n`` points in the series. Args: data (np.array):
 Observed data, presumed to be ordered in time. n (int):
 period over which to calculate the mean Returns: float: a single-valued forecast for the next value in the series. """

    # don't start averaging until we've seen n points
    if len(data[-n:]) < n:
        forecast = np.nan
    else:
        # nb: we'll keep the forecast as a float
        forecast = np.mean(data[-n:])
    return forecast