<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def interp(self, date: timetools.Date) -> float: """Perform a linear value interpolation for the given `date` and return the result. Instantiate a 1-dimensional |SeasonalParameter| object: Define three toy-value pairs: Passing a |Date| object matching a |TOY| object exactly returns the corresponding |float| value: 2.0 5.0 4.0 For all intermediate points, |SeasonalParameter.interp| performs a linear interpolation: 2.096774 4.903226 4.997006 4.002994 Linear interpolation is also allowed between the first and the last pair when they do not capture the endpoints of the year: 3.99449 4.0 3.333333 2.666667 2.0 2.00551 The following example briefly shows interpolation performed for a 2-dimensional parameter: -1.0 1.0 """

        xnew = timetools.TOY(date)
        xys = list(self)
        for idx, (x_1, y_1) in enumerate(xys):
            if x_1 > xnew:
                x_0, y_0 = xys[idx-1]
                break
        else:
            x_0, y_0 = xys[-1]
            x_1, y_1 = xys[0]
        return y_0+(y_1-y_0)/(x_1-x_0)*(xnew-x_0)