code: def _append_max(arr, pad_amt, num, axis=-1):
      """
      Pad one `axis` of `arr` with the maximum of the last `num` elements.
  
      Parameters
      ----------
      arr : ndarray
          Input array of arbitrary shape.
      pad_amt : int
          Amount of padding to append.
      num : int
          Depth into `arr` along `axis` to calculate maximum.
          Range: [1, `arr.shape[axis]`] or None (entire axis)
      axis : int
          Axis along which to pad `arr`.
  
      Returns
      -------
      padarr : ndarray
          Output array, with `pad_amt` values appended along `axis`. The
          appended region is the maximum of the final `num` values along `axis`.
  
      """
      if pad_amt == 0:
          return arr
  
      # Equivalent to edge padding for single value, so do that instead
      if num == 1:
          return _append_edge(arr, pad_amt, axis)
  
      # Use entire array if `num` is too large
      if num is not None:
          if num >= arr.shape[axis]:
              num = None
  
      # Slice a chunk from the edge to calculate stats on
      if num is not None:
          max_slice = _slice_last(arr.shape, num, axis=axis)
      else:
          max_slice = tuple(slice(None) for x in arr.shape)
  
      # Extract slice, calculate max
      max_chunk = arr[max_slice].max(axis=axis, keepdims=True)
  
      # Concatenate `arr` with `max_chunk`, extended along `axis` by `pad_amt`
      return _do_append(arr, max_chunk.repeat(pad_amt, axis=axis), axis)
  
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 15 for calling a global function with example usage: _append_max(arr, pad_amt, num, axis) and returns: _do_append, arr, _append_edge