code: def midpoints(x):
      sl = ()
      for i in range(x.ndim):
          x = (
              x[sl + np.index_exp[:-1]] + x[sl + np.index_exp[1:]]
          ) / 2.0
          sl += np.index_exp[:]
      return x
  
imports: import matplotlib.pyplot
  import numpy
  import matplotlib.colors
label_desc: Use image node_id 1 for calling a global function with example usage: midpoints(x) and returns: x