def METHOD_NAME(pages, num_results=50):
    result = []
    # get first page items
    page = list(next(pages))
    result += page
    while True:
        if not pages.continuation_token:
            break
        # handle num results
        if num_results is not None:
            if num_results == len(result):
                break
        page = list(next(pages))
        result += page
    return result