human
Solve the following python programming problem given the following code:
@overload_method(SeriesType, 'clip')
def series_clip(series, lower, upper):
assistant
#Here is the Python code you requested.

    """Series.clip(...)
    """
    def clip_impl(series, lower, upper):
        data = series._values.copy()
        for i in range(len(data)):
            v = data[i]
            if (v < lower):
                data[i] = lower
            elif (v > upper):
                data[i] = upper
        return Series(data, series._index)
    return clip_impl