def unique_ancestors(node):
    '''
    Returns the list of all nodes dominating the given node, where
    there is only a single path of descent.
    '''
    results = []
    try:
        current = node.parent()
    except __HOLE__:
        # if node is a leaf, we cannot retrieve its parent
        return results
    while current and len(current) == 1:
        results.append(current)
        current = current.parent()
    return results
dataset/ETHPy150Open nltk/nltk/nltk/tgrep.py/unique_ancestors