Does this have to be a function? It looks like you could say:

    has_next_page = page.find('.next.page-numbers').attr.href