Convenience function for piecewise polynomial interpolation
xi : array-like of length N
yi : list of lists of length N
x : scalar or array-like of length M
orders : list of integers, or integer
der : integer
y : scalar or array-like of length R or length M or M by R
If orders is None, or orders[i] is None, then the degree of the polynomial segment is exactly the degree required to match all i available derivatives at both endpoints. If orders[i] is not None, then some derivatives will be ignored. The code will try to use an equal number of derivatives from each end; if the total number of derivatives needed is odd, it will prefer the rightmost endpoint. If not enough derivatives are available, an exception is raised.
Construction of these piecewise polynomials can be an expensive process; if you repeatedly evaluate the same polynomial, consider using the class PiecewisePolynomial (which is what this function does).