code: def linear_interp(times, values, fill=0, name=None, **kw):
      r"""Linear 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
  
      This version of the function enforces the 'linear' kind of interpolation
      (argument to ``scipy.interpolate.interp1d``).
  
      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 = linear_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
      """
      kind = kw.get("kind")
      if kind is None:
          kw["kind"] = "linear"
      elif kind != "linear":
          raise ValueError("Only linear interpolation supported")
      return interp(times, values, fill, name, **kw)
  
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 5 for calling a global function with example usage: linear_interp(times, values, fill, name) and returns: interp