def interpolation(x0, y0, x1, y1, x):
    """
    Performs interpolation.

    Parameters
    ----------
    x0 : float.
        The coordinate of the first point on the x axis.
    y0 : float.
        The coordinate of the first point on the y axis.
    x1 : float.
        The coordinate of the second point on the x axis.
    y1 : float.
        The coordinate of the second point on the y axis.
    x : float.
        A value in the interval (x0, x1).

    Returns
    -------
    float.
        Is the interpolated  or extrapolated value.

    Examples
    --------
    - interpolation 1: (30, 3, 40, 5, 37) -> 4.4
    - interpolation 2: (30, 3, 40, 5, 35) -> 4.0

    """

    return y0 + (y1 - y0) * ((x - x0) / (x1 - x0))