def setedgeval(delta, is_multigraph, graph, orig, dest, idx, key, value):
    """Change a delta to say that an edge stat was set to a certain value"""
    if is_multigraph(graph):
        if (
            graph in delta and 'edges' in delta[graph] and
            orig in delta[graph]['edges'] and dest in delta[graph]['edges'][orig]
            and idx in delta[graph]['edges'][orig][dest]
            and not delta[graph]['edges'][orig][dest][idx]
        ):
            return
        delta.setdefault(graph, {}).setdefault('edge_val', {})\
            .setdefault(orig, {}).setdefault(dest, {})\
            .setdefault(idx, {})[key] = value
    else:
        if (
                                    graph in delta and 'edges' in delta[graph] and
                                orig in delta[graph]['edges'] and dest in delta[graph]['edges'][orig]
                and not delta[graph]['edges'][orig][dest]
        ):
            return
        delta.setdefault(graph, {}).setdefault('edge_val', {})\
            .setdefault(orig, {}).setdefault(dest, {})[key] = value
Change a delta to say that an edge stat was set to a certain value