def pair_existing_key_doors(world, player, door_a, door_b):
    already_paired = False
    door_names = [door_a.name, door_b.name]
    for pd in world.paired_doors[player]:
        if ((pd.door_a in door_names) and (pd.door_b in door_names)):
            already_paired = True
            break
    if already_paired:
        return
    for paired_door in world.paired_doors[player]:
        if ((paired_door.door_a in door_names) or (paired_door.door_b in door_names)):
            paired_door.pair = False
    world.paired_doors[player].append(PairedDoor(door_a, door_b))
def pair_existing_key_doors(world, player, door_a, door_b):
    already_paired = False
    door_names = [door_a.name, door_b.name]
    for pd in world.paired_doors[player]:
        if ((pd.door_a in door_names) and (pd.door_b in door_names)):
            already_paired = True
            break
    if already_paired:
        return
    for paired_door in world.paired_doors[player]:
        if ((paired_door.door_a in door_names) or (paired_door.door_b in door_names)):
            paired_door.pair = False
    world.paired_doors[player].append(PairedDoor(door_a, door_b))