code: def step_function(times, values, name=None, fill=0):
      """Right-continuous step function of time t
  
      Function of t such that
  
      f(times[i]) = values[i]
  
      if t < times[0]:
          f(t) = fill
  
      Parameters
      ----------
      times : (N,) sequence
         Increasing sequence of times
      values : (N,) sequence
         Values at the specified times
      fill : float
         Value on the interval (-np.inf, times[0])
      name : str
         Name of symbolic expression to use. If None, a default is used.
  
      Returns
      -------
      f_t : sympy expr
         Sympy expression f(t) where f is a sympy implemented anonymous
         function of time that implements the step function.  To get the
         numerical version of the function, use ``lambdify_t(f_t)``
  
      Examples
      --------
      >>> s = step_function([0,4,5],[2,4,6])
      >>> tval = np.array([-0.1,3.9,4.1,5.1])
      >>> lam = lambdify_t(s)
      >>> lam(tval)
      array([ 0.,  2.,  4.,  6.])
      """
      if name is None:
          name = "step%d" % step_function.counter
          step_function.counter += 1
  
      def _imp(x):
          x = np.asarray(x)
          f = np.zeros(x.shape) + fill
          for time, val in zip(times, values):
              f[x >= time] = val
          return f
  
      s = implemented_function(name, _imp)
      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 6 for calling a global function with example usage: step_function(times, values, name, fill) and returns: s, f