code: def _get_pad_slice(img, size):
      """Get slices needed for padding.
  
      Args:
          img (~numpy.ndarray): This image is in format CHW.
          size (tuple of two ints): (max_H, max_W).
      """
      _, H, W = img.shape
  
      if H < size[0]:
          margin_y = (size[0] - H) // 2
      else:
          margin_y = 0
      y_slice = slice(margin_y, margin_y + H)
  
      if W < size[1]:
          margin_x = (size[1] - W) // 2
      else:
          margin_x = 0
      x_slice = slice(margin_x, margin_x + W)
  
      return y_slice, x_slice
  
imports: from __future__ import division
  import numpy
  import PIL
  from chainercv.transforms import resize
label_desc: Use image node_id 2 for calling a global function with example usage: _get_pad_slice(img, size) and returns: y_slice,  x_slice