def make_linear_interpolation_fun(pairs):
    """Build and return function interpolating the provided input points.

    Parameters
    ----------
    pairs : list of tuples
        The returned function interpolates linearly between the values.
        Every element of this list should be a pair of numeric values, the
        first one representing the x-axis and the second one the y-axis.
    
    Returns
    -------
    A function returning a single numeric output for each numeric input.
    The function returns a fixed value of 200 if given an input outside of its
    range of definition.
    The returned function also accepts unnamed optional arguments that are not
    actually used. This is to accomodate the requirements of qutip.mesolve.

    Example
    -------
    >>> make_linear_interpolation_fun([(0, 0), (2, 2), (4, 2)])(
    1.0
    """
    OUT_OF_BOUNDARIES_VALUE = 200
    def fun(t, *args):
        for idx, (x, y) in enumerate(pairs):
            if t >= x:
                # this should not happen: we are outside the region in which
                # the function is defined
                if idx == len(pairs) - 1:  # last element of the list of pair
                    # we make sure that are significantly outside of the
                    # interval of definition, to avoid numerical shenaningans
                    # around the final border
                    if t > 1.1 * x:
                        return OUT_OF_BOUNDARIES_VALUE
                    else:
                        return y
                if t >= pairs[idx + 1][0]:
                    continue
                # else we are in the correct bracket
                slope = (pairs[idx + 1][1] - y) / (pairs[idx + 1][0] - x)
                return y + (t - x) * slope
        # if we are still here, then the input is smaller than all the x values
        # with which the function has been defined. In this case just return 
        # the fixed out of boundaries value
        return OUT_OF_BOUNDARIES_VALUE
    return fun