def getAttribute(element, attrName, regEx=""):
    if element.nodeType != element.ELEMENT_NODE:
        raise SyntaxError("Wrong node type in getAttribute()")

    value = element.getAttribute(attrName)
    if value:
        if not re.match(regEx, value):
            raise SyntaxError("Bad Attribute Value for '%s': '%s' " % (attrName, value))
        element.removeAttribute(attrName)
        return str(value) #de-unicode it; this is needed for bsddb, for example
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/tlslite/utils/xmltools.py/getAttribute/original