from lxml import etree
from io import BytesIO
f=open('....\xmltest2.xml')
xml=f.read()
print (xml)
string2="//port"+"[state[@reason_ttl='1']]"
nodes_nmap=tree.xpath(string2)
print (nodes_nmap)
for node in nodes_nmap:
print (node.values())
ZnJvbSBseG1sIGltcG9ydCBldHJlZQpmcm9tIGlvIGltcG9ydCBCeXRlc0lPCmY9b3BlbignLi4uLlx4bWx0ZXN0Mi54bWwnKQp4bWw9Zi5yZWFkKCkKcHJpbnQgKHhtbCkKc3RyaW5nMj0iLy9wb3J0IisiW3N0YXRlW0ByZWFzb25fdHRsPScxJ11dIgpub2Rlc19ubWFwPXRyZWUueHBhdGgoc3RyaW5nMikKcHJpbnQgKG5vZGVzX25tYXApCmZvciBub2RlIGluIG5vZGVzX25tYXA6CiAgICBwcmludCAobm9kZS52YWx1ZXMoKSk=