code: def lagrange(pairs):
    
    prod = lambda args: reduce(operator.mul, args)
    xv, yv = xzip(*pairs)
    return lambda k: sum( yv[j] * prod( (k - rk) / (rj - rk)
                                        for rk in xv if rj != rk )
                          for j, rj in enumerate(xv) )
docs: Waring-Lagrange interpolator function.
  
    Parameters
    ----------
    pairs :
      Iterable with pairs (tuples with two values), corresponding to points
      ``(x, y)`` of the function.
  
    Returns
    -------
    A function that returns the interpolator result for a given ``x``.