def _graph_wrap(func, graph):
    """Constructs function encapsulated in the graph."""
    @wraps(func)
    def _wrapped(*args, **kwargs):
        with graph.as_default():
            return func(*args, **kwargs)
    return _wrapped
Constructs function encapsulated in the graph.