code: def shift_and_pad(array, dist, pad="__null__"):
      
      length = len(array)
      if length == 0:
          return []
  
      if pad == "__null__":
          if dist > 0:
              padding_item = array[0]
          elif dist < 0:
              padding_item = array[-1]
          else:
              padding_item = None
      else:
          padding_item = pad
  
      if abs(dist) >= length:
          return length * [padding_item, ]
      elif dist == 0:
          return list(array)
      elif dist > 0:
          return [padding_item, ] * dist + array[:-dist]
      elif dist < 0:
          return array[-dist:] + [padding_item, ] * -dist
      else:  # Never get in this logic
          raise Exception
docs: Shift and pad with item.
  
      :params array: list like iterable object
      :params dist: int
      :params pad: any value
  
      Example::
  
          >>> array = [0, 1, 2]
          >>> shift_and_pad(array, 0)
          [0, 1, 2]
  
          >>> shift_and_pad(array, 1)
          [0, 0, 1]
  
          >>> shift_and_pad(array, -1)
          [1, 2, 2]
  
          >>> shift_and_pad(array, 3)
          [0, 0, 0]
  
          >>> shift_and_pad(array, -3)
          [2, 2, 2]
  
          >>> shift_and_pad(array, -1, None)
          [None, 0, 1]