code: def interp(times, values, fill=0, name=None, **kw):
      r"""Generic interpolation function of t given `times` and `values`
  
      Imterpolator such that:
  
      f(times[i]) = values[i]
  
      if t < times[0] or t > times[-1]:
          f(t) = fill
  
      See ``scipy.interpolate.interp1d`` for details of interpolation
      types and other keyword arguments.  Default is 'kind' is linear,
      making this function, by default, have the same behavior as
      ``linear_interp``.
  
      Parameters
      ----------
      times : array-like
          Increasing sequence of times
      values : array-like
          Values at the specified times
      fill : None or float, optional
          Value on the interval (-np.inf, times[0]). Default 0. If None, raises
          error outside bounds
      name : None or str, optional
          Name of symbolic expression to use. If None, a default is used.
      \*\*kw : keyword args, optional
          passed to ``interp1d``
  
      Returns
      -------
      f : sympy expression
          A Function of t.
  
      Examples
      --------
      >>> s = interp([0,4,5.],[2.,4,6])
      >>> tval = np.array([-0.1,0.1,3.9,4.1,5.1])
      >>> res = lambdify_t(s)(tval)
  
      0 outside bounds by default
  
      >>> np.allclose(res, [0, 2.05, 3.95, 4.2, 0])
      True
      """
      if fill is not None:
          if kw.get("bounds_error") is True:
              raise ValueError("fill conflicts with bounds error")
          fv = kw.get("fill_value")
          if not (
              fv is None or fv is fill or fv == fill
          ):  # allow for fill=np.nan
              raise ValueError("fill conflicts with fill_value")
          kw["bounds_error"] = False
          kw["fill_value"] = fill
      interpolator = Interp1dNumeric(times, values, **kw)
      # make a new name if none provided
      if name is None:
          name = "interp%d" % interp.counter
          interp.counter += 1
      s = implemented_function(name, interpolator)
      return s(T)
  
imports: import itertools
  import numpy
  import sympy
  from scipy.interpolate import interp1d
  from sympy import DiracDelta, Symbol
  from sympy.utilities.lambdify import implemented_function, lambdify
  from nipy.algorithms.statistics.formula.formulae import Formula, Term
label_desc: Use image node_id 4 for calling a global function with example usage: interp(times, values, fill, name) and returns: s