from bs4 import BeautifulSoup
import re


def verify_page(page_req):
    """Given a page request returns a match of which page it belongs to."""
    input_box_id = 'informado'
    cv_page_req_href = 'download'
    not_found_match = "<html><head><title>Curr\xedculo n\xe3o encontrado!"\
                      "</title></head><body><div style='font-family:Arial;"\
                      "font-size=10pt;align:center;color:red;font-weight:"\
                      "bold'>Curr\xedculo n\xe3o encontrado</div></body>"\
                      "</html>"
    content = page_req.content
    soup = BeautifulSoup(content, 'lxml')
    if soup.find(id=input_box_id):
        return 'CAPTCHA'
    elif soup.find(href=re.compile(cv_page_req_href)):
        return 'CVPAGE'
    else:
        if content == not_found_match:
            return 'NOTFOUND'