:return: an attribute from the parsed element if it has the attribute,
    otherwise the default value

def get_element_attribute(elem_to_parse, attrib_name, default_value=u''):
    """
    :return: an attribute from the parsed element if it has the attribute,
    otherwise the default value
    """

    element = get_element(elem_to_parse)

    if element is None:
        return default_value

    return element.attrib.get(attrib_name, default_value)