def callgraph_edge_pruning(callgraph, pruned_edges):
    """
    pruning spurious indirect call edges in callgraph
    callgraph: callgraph object
    pruned_edges: pruned edges from address-taken or type-based pruning, format:
        {
            "caller": [pruned_targets],
        }
    """
    for edge in callgraph.edges.data():
        caller_id = edge[0]
        callee_id = edge[1]
        attr = edge[2]
        if attr["color"] == "red":
            caller_name = callgraph.nodes[caller_id]["label"].strip()[2:-2]
            callee_name = callgraph.nodes[callee_id]["label"].strip()[2:-2]
            print("{}->{}".format(caller_name, callee_name))
            if caller_name in pruned_edges.keys():
                if callee_name in pruned_edges[caller_name]:
                    # this edge in the pruned_edges dictionary, should be removed in callgraph
                    callgraph.remove_edge(caller_id, callee_id)
                    print("pruned")
    return callgraph