starting from the given node, traverse ingoing edges up to the root element
    of the sentence. return the given node attribute from all the nodes visited
    along the way.

def traverse_dependencies_up(docgraph, node_id, node_attr=None):
    """
    starting from the given node, traverse ingoing edges up to the root element
    of the sentence. return the given node attribute from all the nodes visited
    along the way.
    """
    # there's only one, but we're in a multidigraph
    source, target = docgraph.in_edges(node_id)[0]
    traverse_attr = node_attr if node_attr else docgraph.lemma_attr

    attrib_value = docgraph.node[source].get(traverse_attr)
    if attrib_value:
        yield attrib_value

    if istoken(docgraph, source) is True:
        for attrib_value in traverse_dependencies_up(docgraph, source,
                                                     traverse_attr):
            yield attrib_value