def get_page_id(title, query_results):
    """
    Extracts the title's pageid from the query results.
    Assumes queries of the form query:pages:id,
    and properly handle the normalized method.
    Returns -1 if it cannot find the page id
    """
    if 'normalized' in query_results['query'].keys():
        for normalized in query_results['query']['normalized']:
            if title == normalized['from']:
                title = normalized['to']
    for page in query_results['query']['pages']:
        if title == query_results['query']['pages'][page]['title']:
            return str(query_results['query']['pages'][page]['pageid'])
    return str(-1)