def normalize_page_number(page_number, page_range):
    """Handle a negative *page_number*.

    Return a positive page number contained in *page_range*.
    If the negative index is out of range, return the page number 1.
    """
    try:
        return page_range[page_number]
    except __HOLE__:
        return page_range[0]
dataset/ETHPy150Open frankban/django-endless-pagination/endless_pagination/utils.py/normalize_page_number