def extract_text(dom, name, wrapper=None):
    """
    Function tries to extract text data from the first tag
    with a given name and wrapps it in a give function / class.
    """
    elements = dom.getElementsByTagName(name)
    if elements:
        text = elements[0].lastChild.data
    else:
        text = ""
    return wrapper(text) if wrapper else text

    Function tries to extract text data from the first tag
    with a given name and wrapps it in a give function / class.
    
recipes/Python/577018_Wordzecom_API_bindings/recipe-577018.py