def METHOD_NAME(sdfg, graph):
    # fix sdfg as for now the SDFG gets parsed wrongly
    for node in graph.nodes():
        if isinstance(node, dace.sdfg.nodes.NestedSDFG):
            nested_original = node
            for edge in itertools.chain(graph.in_edges(node), graph.out_edges(node)):
                for e in graph.memlet_tree(edge):
                    if 'z' in e.data.subset.free_symbols:
                        new_subset = str(e.data.subset)
                        new_subset = new_subset.replace('z', '0:O')
                        e.data.subset = subsets.Range.from_string(new_subset)
    # next up replace sdfg
    inner_sdfg = helper_sdfg.to_sdfg()
    nnode = graph.add_nested_sdfg(inner_sdfg, sdfg, {'AA', 'BB', 'CC'}, {'CC'})
    # redirect edges
    connectors = []
    for e in graph.in_edges(nested_original):
        connectors.append(e.dst_conn)
    connectors.sort()
    for e in graph.in_edges(nested_original):
        if e.dst_conn == connectors[0]:
            graph.add_edge(e.src, e.src_conn, e.dst, 'AA', e.data)
            graph.remove_edge(e)
        if e.dst_conn == connectors[1]:
            graph.add_edge(e.src, e.src_conn, e.dst, 'BB', e.data)
            graph.remove_edge(e)
        if e.dst_conn == connectors[2]:
            graph.add_edge(e.src, e.src_conn, e.dst, 'CC', e.data)
            graph.remove_edge(e)
    e = graph.out_edges(nested_original)[0]
    graph.add_edge(e.src, 'CC', e.dst, e.dst_conn, e.data)
    graph.remove_edge(e)
    utils.change_edge_dest(graph, nested_original, nnode)
    utils.change_edge_src(graph, nested_original, nnode)
    graph.remove_node(nested_original)
    sdfg.validate()