xxxxxxxxxx
from lxml import etree
# Assume we have an XML document stored in the 'xml_data' variable
# Create an ElementTree object from the XML data
tree = etree.ElementTree(etree.fromstring(xml_data))
# Find a specific element in the XML document
element = tree.xpath('//some_element')
# Get the parent of the found element using the '..' syntax
parent = element[0].xpath('..')
# Print the parent element to demonstrate the result
print(parent[0].tag)