def linear_function(
        x1,
        x2,
        y1,
        y2,
        x,
):
    """
    linear function, given a line and a point on that line, It would output the y value corresponding to the x value
    :param x1: x value of point 1
    :param x2: x value of point 2
    :param y1: y value of point 1
    :param y2: y value of point 2
    :param x: x value corresponding to wanted y value
    :return: y value corresponding to the given x value
    """
    k = (y2 - y1) / (x2 - x1)
    y = k * (x - x1) + y1
    return y