from bs4 import BeautifulSoup


def get_category_number_of_pages(markup):
    """
    A method that returns the maximal page number for a given markup, used for pagination handling.

    :param markup: a requests.response.content object
    :rtype: int
    """
    html_parser = BeautifulSoup(markup, "html.parser")
    offers = html_parser.find(class_="current")
    return int(offers.text) if offers else 1