code: def cubic(x):
      """A cubic B-spline.
  
      This is a special case of `bspline`, and equivalent to ``bspline(x, 3)``.
      """
      ax = abs(asarray(x))
      res = zeros_like(ax)
      cond1 = less(ax, 1)
      if cond1.any():
          ax1 = ax[cond1]
          res[cond1] = 2.0 / 3 - 1.0 / 2 * ax1**2 * (2 - ax1)
      cond2 = ~cond1 & less(ax, 2)
      if cond2.any():
          ax2 = ax[cond2]
          res[cond2] = 1.0 / 6 * (2 - ax2) ** 3
      return res
  
imports: from __future__ import division, print_function, absolute_import
  from scipy._lib.six import xrange
  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, gamma
label_desc: Use image node_id 6 for calling a global function with example usage: cubic(x) and returns: res