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

    value = element.getAttribute(attrName)
    if not value:
        raise SyntaxError("Missing Attribute: " + attrName)
    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/getReqAttribute/original