code: def natural_spline(t, knots=None, order=3, intercept=False):
      """Return a Formula containing a natural spline
  
      Spline for a Term with specified `knots` and `order`.
  
      Parameters
      ----------
      t : ``Term``
      knots : None or sequence, optional
         Sequence of float.  Default None (same as empty list)
      order : int, optional
         Order of the spline. Defaults to a cubic (==3)
      intercept : bool, optional
         If True, include a constant function in the natural
         spline. Default is False
  
      Returns
      -------
      formula : Formula
           A Formula with (len(knots) + order) Terms (if intercept=False,
           otherwise includes one more Term), made up of the natural spline
           functions.
  
      Examples
      --------
      >>> x = Term('x')
      >>> n = natural_spline(x, knots=[1,3,4], order=3)
      >>> xval = np.array([3,5,7.]).view(np.dtype([('x', np.float64)]))
      >>> n.design(xval, return_float=True)
      array([[   3.,    9.,   27.,    8.,    0.,   -0.],
             [   5.,   25.,  125.,   64.,    8.,    1.],
             [   7.,   49.,  343.,  216.,   64.,   27.]])
      >>> d = n.design(xval)
      >>> print(d.dtype.descr)
      [('ns_1(x)', '<f8'), ('ns_2(x)', '<f8'), ('ns_3(x)', '<f8'), ('ns_4(x)', '<f8'), ('ns_5(x)', '<f8'), ('ns_6(x)', '<f8')]
      """
      if knots is None:
          knots = {}
      fns = []
      for i in range(order + 1):
          n = "ns_%d" % i
  
          def f(x, i=i):
              return x**i
  
          s = implemented_function(n, f)
          fns.append(s(t))
  
      for j, k in enumerate(knots):
          n = "ns_%d" % (j + i + 1,)
  
          def f(x, k=k, order=order):
              return (x - k) ** order * np.greater(x, k)
  
          s = implemented_function(n, f)
          fns.append(s(t))
  
      if not intercept:
          fns.pop(0)
  
      ff = Formula(fns)
      return ff
  
imports: import itertools
  import warnings
  from string import ascii_letters, digits
  import numpy
  import sympy
  from scipy.linalg import pinv
  from sympy import Dummy, default_sort_key
  from sympy.utilities.lambdify import implemented_function, lambdify
  from nipy.algorithms.utils.matrices import full_rank, matrix_rank
  from nipy.utils import VisibleDeprecationWarning, _NoValue
label_desc: Use image node_id 9 for calling a global function with example usage: natural_spline(t, knots, order, intercept) and returns: ff, unknown, unknown