human
Complete this python program:
def createNextMethod(methodName, pageTokenName='pageToken', nextPageTokenName='nextPageToken', isPageTokenParameter=True):
assistant
#Here is the Python program you requested.

    """Creates any _next methods for attaching to a Resource.
    The _next methods allow for easy iteration through list() responses.
    Args:
    methodName: string, name of the method to use.
    pageTokenName: string, name of request page token field.
    nextPageTokenName: string, name of response page token field.
    isPageTokenParameter: Boolean, True if request page token is a query
    parameter, False if request page token is a field of the request body.
    """
    methodName = fix_method_name(methodName)
    def methodNext(self, previous_request, previous_response):
        "Retrieves    the    next    page    of    results.\n\nArgs:\n        previous_request:    The    request    for    the    previous    page.    (required)\n        previous_response:    The    response    from    the    request    for    the    previous    page.    (required)\n\nReturns:\n        A    request    object    that    you    can    call    'execute()'    on    to    request    the    next\n        page.    Returns    None    if    there    are    no    more    items    in    the    collection.\n                "
        nextPageToken = previous_response.get(nextPageTokenName, None)
        if (not nextPageToken):
            return None
        request = copy.copy(previous_request)
        if isPageTokenParameter:
            request.uri = _add_query_parameter(request.uri, pageTokenName, nextPageToken)
            logger.info(('Next    page    request    URL:    %s    %s' % (methodName, request.uri)))
        else:
            model = self._model
            body = model.deserialize(request.body)
            body[pageTokenName] = nextPageToken
            request.body = model.serialize(body)
            logger.info(('Next    page    request    body:    %s    %s' % (methodName, body)))
        return request
    return (methodName, methodNext)