def iterDescendantsWithAttribute(dom, tagName, attrName, attrValue,
                                 max_depth = 0):
    '''\
    Iterate over descendant elements whose name is contained in
    tagName (or is named tagName if tagName is a string) and have an
    attribute named attrName with value attrValue.  Only consider
    nodes up to max_depth deep when max_depth is greater than zero.
    '''
    if isinstance(tagName, basestring):
        tagName = (tagName,)
    def match(d):
        return d.tagName in tagName and \
            d.getAttribute(attrName) == attrValue
    return iterMatchingDescendants(dom, match, max_depth)
dataset/ETHPy150Open coreemu/core/daemon/core/misc/xmlutils.py/iterDescendantsWithAttribute/original