def find_childless_node(digraph):
    """Finds and returns a childless node in the digraph,
    or returns None if there are none.
    """
    for node in digraph.nodes():
        if node.num_children() == 0:
            return node
    return None