def scrape_page_count(source):
    """Takes in the source from Immowelt and finds how many pages with
    listings exists. Does this by finding the label of a button that
    goes to the last page. Button is located at the buttom of the page.

    Args:
        source (BeautifulSoup): The html source of the page.

    Returns:
        int: The number of pages with listings.
    """
    # Row with buttons to navigate to different pages. Numeric labels.
    buttons = source.findAll("a", "btn_01 white")

    # Get the last button, indicating the last page
    last_button = buttons[-1]

    # Get the label value from the button
    last_page = int(last_button['href'].split("=")[-1])

    return last_page