<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def collapse_pair(graph, survivor: BaseEntity, victim: BaseEntity) -> None: """Rewire all edges from the synonymous node to the survivor node, then deletes the synonymous node. Does not keep edges between the two nodes. :param pybel.BELGraph graph: A BEL graph :param survivor: The BEL node to collapse all edges on the synonym to :param victim: The BEL node to collapse into the surviving node """

    graph.add_edges_from(
        (survivor, successor, key, data)
        for _, successor, key, data in graph.out_edges(victim, keys=True, data=True)
        if successor != survivor
    )

    graph.add_edges_from(
        (predecessor, survivor, key, data)
        for predecessor, _, key, data in graph.in_edges(victim, keys=True, data=True)
        if predecessor != survivor
    )

    graph.remove_node(victim)