def print_model_execution_graph(graph):
    """Pretty print of a model execution graph."""

    def nids_as_str(nids):
        return ", ".join(["%s" % nid for nid in nids])

    def print_node(node):
        print("  [NID: %4s] [Layer: %20s] "
              "[Inputs from: %20s] [Outputs to: %20s]" %
              (node["nid"],
               node["layer"].name,
               nids_as_str(node["Xs_nids"]),
               nids_as_str(node["Ys_nids"]),))

    if None in graph:
        print("Graph input layers:")
        for tmp in graph[None]:
            print_node(tmp)

    print("Graph nodes:")
    for nid in sorted([k for k in graph if k is not None]):
        if nid is None:
            continue
        print_node(graph[nid])