def _get_required_attribute(node, attr):
    """Return an attribute by name.  Raise ParseError if not present."""

    if not node.hasAttribute(attr):
        raise ParseError(
            'Expecting %s attribute in element %s' % (attr, node.tagName))

    return node.getAttribute(attr)
def _get_required_attribute ( node , attr ) : if not node . hasAttribute ( attr ) : raise ParseError ( 'Expecting %s attribute in element %s' % ( attr , node . tagName ) ) return node . getAttribute ( attr )
Return an attribute by name.  Raise ParseError if not present.