code: def paginate(limit, start_arg="next_token", limit_arg="max_results"):
      
      default_start = 0
  
      def outer_wrapper(func):
          @functools.wraps(func)
          def wrapper(*args, **kwargs):
              start = int(default_start if kwargs.get(start_arg) is None else kwargs[start_arg])
              lim = int(limit if kwargs.get(limit_arg) is None else kwargs[limit_arg])
              stop = start + lim
              result = func(*args, **kwargs)
              limited_results = list(itertools.islice(result, start, stop))
              next_token = stop if stop < len(result) else None
              return limited_results, next_token
          return wrapper
      return outer_wrapper
docs: Returns a limited result list, and an offset into list of remaining items
  
      Takes the next_token, and max_results kwargs given to a function and handles
      the slicing of the results. The kwarg `next_token` is the offset into the
      list to begin slicing from. `max_results` is the size of the result required
  
      If the max_results is not supplied then the `limit` parameter is used as a
      default
  
      :param limit_arg: the name of argument in the decorated function that
      controls amount of items returned
      :param start_arg: the name of the argument in the decorated that provides
      the starting offset
      :param limit: A default maximum items to return
      :return: a tuple containing a list of items, and the offset into the list