'Construct a piecewise polynomial from a spline
Parameters
tck
A spline, as returned by `splrep` or a BSpline object.
extrapolate : bool or \'periodic\', optional
If bool, determines whether to extrapolate to out-of-bounds points
based on first and last intervals, or to return NaNs.
If \'periodic\', periodic extrapolation is used. Default is True.'

@classmethod
def from_spline(cls, tck, extrapolate=None):

    if isinstance(tck, BSpline):
        (t, c, k) = tck.tck
        if (extrapolate is None):
            extrapolate = tck.extrapolate
    else:
        (t, c, k) = tck
    cvals = np.empty(((k + 1), (len(t) - 1)), dtype=c.dtype)
    for m in xrange(k, (-1), (-1)):
        y = fitpack.splev(t[:(-1)], tck, der=m)
        cvals[(k - m), :] = (y / spec.gamma((m + 1)))
    return cls.construct_fast(cvals, t, extrapolate)
