code: def bspline(x, n):
      """B-spline basis function of order n.
  
      Parameters
      ----------
      x : array_like
          a knot vector
      n : int
          The order of the spline. Must be non-negative, i.e., n >= 0
  
      Returns
      -------
      res : ndarray
          B-spline basis function values
  
      See Also
      --------
      cubic : A cubic B-spline.
      quadratic : A quadratic B-spline.
  
      Notes
      -----
      Uses numpy.piecewise and automatic function-generator.
  
      Examples
      --------
      We can calculate B-Spline basis function of several orders:
  
      >>> from scipy.signal import bspline, cubic, quadratic
      >>> bspline(0.0, 1)
      1
  
      >>> knots = [-1.0, 0.0, -1.0]
      >>> bspline(knots, 2)
      array([0.125, 0.75, 0.125])
  
      >>> np.array_equal(bspline(knots, 2), quadratic(knots))
      True
  
      >>> np.array_equal(bspline(knots, 3), cubic(knots))
      True
  
      """
      ax = -abs(asarray(x))
      # number of pieces on the left-side is (n+1)/2
      funclist, condfuncs = _bspline_piecefunctions(n)
      condlist = [func(ax) for func in condfuncs]
      return piecewise(ax, condlist, funclist)
  
imports: from numpy import logical_and, asarray, pi, zeros_like, piecewise, array, arctan2, tan, zeros, arange, floor
  from numpy.core.umath import sqrt, exp, greater, less, cos, add, sin, less_equal, greater_equal
  from .spline import cspline2d, sepfir2d
  from scipy.special import comb
  from scipy._lib._util import float_factorial
label_desc: Use image node_id 3 for calling a global function with example usage: bspline(x, n) and returns: piecewise