def leafage(elts, fun_deps):
    """Get all leafs of DAG

    >>> graph = {2: [1]}
    >>> get_children = lambda n: graph.get(n, [])
    >>> list(leafage([], get_children))
    []
    >>> list(leafage([2, 1], get_children))
    [1]
    >>> sorted(leafage([2, 3], get_children))
    [1, 3]

    """
    done = set([])
    todo = set(elts)
    leafs = set([])
    while todo:
        e = todo.pop()
        done.add(e)
        deps = fun_deps(e)
        if len(deps) == 0:
            leafs.add(e)
        else:
            for d in deps:
                if d not in done:
                    todo.add(d)
    return leafs
