import logging


def check_web_page(web_page, max_nodes=7000):
    """Check if the web page is good to be used for training.

    Args:
        web_page (WebPage)
        max_nodes (int)
    Returns:
        boolean
    """
    if len(web_page.nodes) == 1:
        logging.warn('%s has only 1 node; skip', web_page.filename)
        return False
    if len(web_page.nodes) > max_nodes:
        logging.warn('%s has too many nodes (%d > %d); skip',
                web_page.filename, len(web_page.nodes), max_nodes)
        return False
    if len(web_page.graph.nodes) < 2:
        logging.warn('%s has less than 2 graph nodes; skip', web_page.filename)
        return False
    return True