code: def _arange_ndarray(arr, shape, axis, reverse=False):
      """
      Create an ndarray of `shape` with increments along specified `axis`
  
      Parameters
      ----------
      arr : ndarray
          Input array of arbitrary shape.
      shape : tuple of ints
          Shape of desired array. Should be equivalent to `arr.shape` except
          `shape[axis]` which may have any positive value.
      axis : int
          Axis to increment along.
      reverse : bool
          If False, increment in a positive fashion from 1 to `shape[axis]`,
          inclusive. If True, the bounds are the same but the order reversed.
  
      Returns
      -------
      padarr : ndarray
          Output array sized to pad `arr` along `axis`, with linear range from
          1 to `shape[axis]` along specified `axis`.
  
      Notes
      -----
      The range is deliberately 1-indexed for this specific use case. Think of
      this algorithm as broadcasting `np.arange` to a single `axis` of an
      arbitrarily shaped ndarray.
  
      """
      initshape = tuple(
          1 if i != axis else shape[axis]
          for (i, x) in enumerate(arr.shape)
      )
      if not reverse:
          padarr = np.arange(1, shape[axis] + 1)
      else:
          padarr = np.arange(shape[axis], 0, -1)
      padarr = padarr.reshape(initshape)
      for i, dim in enumerate(shape):
          if padarr.shape[i] != dim:
              padarr = padarr.repeat(dim, axis=i)
      return padarr
  
imports: from __future__ import division, absolute_import, print_function
  import numpy
  from numpy.core.overrides import array_function_dispatch
label_desc: Use image node_id 1 for calling a global function with example usage: _arange_ndarray(arr, shape, axis, reverse) and returns: padarr