code: def _pad(arr, pads, pad_value):
      out = np.pad(
          arr,
          np.maximum(0, pads),
          mode="constant",
          constant_values=pad_value,
      ).astype(arr.dtype)
      slices = tuple(
          _slice(abs(lo) if lo < 0 else 0, hi % dim if hi < 0 else None)
          for (lo, hi), dim in zip(pads, np.shape(arr))
      )
      return out[slices]
  
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 39 for calling a global function with example usage: _pad(arr, pads, pad_value) and returns: out