def paginate(request, queryset, results_per_page=20):
    paginator = Paginator(queryset, results_per_page)

    try:
        page = paginator.page(int(request.GET.get('page', 1)))
    except InvalidPage:
        raise Http404("Sorry, that page of results does not exist.")
    except __HOLE__:
        raise PermissionDenied()
        
    return page, paginator
dataset/ETHPy150Open mozilla/source/source/base/utils.py/paginate