code: def image_slice(x, X, B, D, pad=0):
      start = x * B - pad
      stop = start + D
      pad = [0, 0]
      if start < 0:
          pad[0] = -start
          start = 0
      if stop - 1 >= X:
          pad[1] = stop - X
      return start, stop, pad
  
imports: from __future__ import division
  import numpy
  from struct import pack, unpack
  from neon import logger
label_desc: Use image node_id 15 for calling a global function with example usage: image_slice(x, X, B, D, pad) and returns: start,  stop,  pad