#NEWLINE# def unique_ancestors( node ) : #NEWLINE# #INDENT# '\n    Returns the list of all nodes dominating the given node, where\n    there is only a single path of descent.\n    ' #NEWLINE# results = [ ] #NEWLINE# try : #NEWLINE# #INDENT# current = node . parent ( ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# return results #NEWLINE# #UNINDENT# while ( current and ( len ( current ) == 1 ) ) : #NEWLINE# #INDENT# results . append ( current ) #NEWLINE# current = current . parent ( ) #NEWLINE# #UNINDENT# return results