def unique_ancestors(node):
 results = []
 try:
  current = node.parent()
 except AttributeError:
  return results
 while (current and (len(current) == 1)):
  results.append(current)
  current = current.parent()
 return results

def unique_ancestors ( node ) : results = [ ] try : current = node . parent ( ) except AttributeError : return results while ( current and ( len ( current ) == 1 ) ) : results . append ( current ) current = current . parent ( ) return results
returns the list of all nodes dominating the given node .