import copy


def extend_Delta(Delta, new_edges):
    """Given a dict Delta,  and new_edges which is a list [ ((a,b), C) ...], 
       in case (a,b) is in Delta, add to Delta (a,b) : (C | Delta[(a,b)])
       else add to Delta (a,b) : C. Return the final Delta.
    """
    DeltaOut = copy.deepcopy(Delta)
    for ((a,b),C) in new_edges:
        if (a,b) in Delta:
            DeltaOut.update ( { (a,b) : C | Delta[(a,b)] })
        else:
            DeltaOut.update ( { (a,b) : C })
    return DeltaOut