code: def _reducer_from_pyfunc(py_binop, init_val):
      def reducer(operand, axis=0):
          axis = range(np.ndim(operand)) if axis is None else axis
          result = np.full(
              np.delete(np.shape(operand), axis),
              init_val,
              dtype=np.asarray(operand).dtype,
          )
          for idx, _ in np.ndenumerate(operand):
              out_idx = tuple(np.delete(idx, axis))
              result[out_idx] = py_binop(result[out_idx], operand[idx])
          return result
  
      return reducer
  
imports: import builtins
  import collections
  import itertools
  import numpy
  import opt_einsum
  import scipy.special
  from jax._src import dtypes
  from jax._src import util
label_desc: Use image node_id 46 for calling a global function with example usage: _reducer_from_pyfunc(py_binop, init_val) and returns: reducer, result