def deepest_node(xxx_todo_changeme1, graph):
(subj, pred, obj) = xxx_todo_changeme1<EOL>to_return = []<EOL>def _deepest_node(xxx_todo_changeme, graph):<EOL><INDENT>(subj, pred, obj) = xxx_todo_changeme<EOL>children = []<EOL>if isinstance(obj, rt.BNode):<EOL><INDENT>for s, p, o in graph:<EOL><INDENT>if str(s) == str(obj):<EOL><INDENT>children.append((s, p, o))<EOL><DEDENT><DEDENT>for s, p, o in children:<EOL><INDENT>s1, p1, o1 = _deepest_node((s, p, o), graph)<EOL>if "<STR_LIT>" in str(o1) and (s1, p1, o1) not in to_return:<EOL><INDENT>to_return.append((s1, p1, o1))<EOL><DEDENT><DEDENT>return (s1, p1, o1)<EOL><DEDENT>else:<EOL><INDENT>return (subj, pred, obj)<EOL><DEDENT><DEDENT>_deepest_node((subj, pred, obj), graph)<EOL>return to_return<EOL>
recurse down the tree and return a list of the most deeply nested
    child nodes of the given triple