def fixxpath(root, xpath):
 (namespace, root_tag) = root.tag[1:].split('}', 1)
 fixed_xpath = '/'.join([('{%s}%s' % (namespace, e)) for e in xpath.split('/')])
 return fixed_xpath

def fixxpath ( root , xpath ) : ( namespace , root_tag ) = root . tag [ 1 : ] . split ( '}' , 1 ) fixed_xpath = '/' . join ( [ ( '{%s}%s' % ( namespace , e ) ) for e in xpath . split ( '/' ) ] ) return fixed_xpath
elementtree wants namespaces in its xpaths .