def get_attribute(file, element):
    '''
    Return the attributes of the matched xpath element.

    CLI Example:

    .. code-block:: bash

        salt '*' xml.get_attribute /tmp/test.xml ".//element[@id='3']"
    '''
    try:
        root = ET.parse(file)
        element = root.find(element)
        return element.attrib
    except AttributeError:
        log.error("Unable to find element matching %s", element)
        return False
def get_attribute ( file , element ) : try : root = ET . parse ( file ) element = root . find ( element ) return element . attrib except AttributeError : log . error ( "Unable to find element matching %s" , element ) return False
Return the attributes of the matched xpath element.

    CLI Example:

    .. code-block:: bash

        salt '*' xml.get_attribute /tmp/test.xml ".//element[@id='3']"