doc = """<root xmlns="http://really-long-namespace.uri"
    xmlns:other="http://with-ambivalent.end/#">
    <other:elem/>
</root>"""
tree = lxml.etree.fromstring(doc)
print(xpath_ns(tree, '/root'))
print(xpath_ns(tree, '/root/elem'))
print(xpath_ns(tree, '/root/other:elem'))
How to find XML Elements via XPath in Python in a namespace-agnostic way?