code: def _move_datetime(dt, direction, delta):
      
      if direction == 'next':
          dt = dt + delta
      elif direction == 'last':
          dt = dt - delta
      else:
          pass
          # raise some delorean error here
      return dt
docs: Move datetime given delta by given direction