def enable_new_entrances(region, connections, potentials, enabled, world, player):
    new_region = connections[region.name]
    if (new_region in potentials.keys()):
        for potential in potentials.pop(new_region):
            enabled[potential] = (region.name, region.dungeon)
    queue = deque(new_region.exits)
    visited = set()
    while (len(queue) > 0):
        ext = queue.popleft()
        visited.add(ext)
        region_name = ext.connected_region.name
        if ((region_name in connections.keys()) and (connections[region_name] in potentials.keys())):
            for potential in potentials.pop(connections[region_name]):
                enabled[potential] = (region.name, region.dungeon)
        if (ext.connected_region.name in world.inaccessible_regions[player]):
            for new_exit in ext.connected_region.exits:
                if (new_exit not in visited):
                    queue.append(new_exit)
def enable_new_entrances(region, connections, potentials, enabled, world, player):
    new_region = connections[region.name]
    if (new_region in potentials.keys()):
        for potential in potentials.pop(new_region):
            enabled[potential] = (region.name, region.dungeon)
    queue = deque(new_region.exits)
    visited = set()
    while (len(queue) > 0):
        ext = queue.popleft()
        visited.add(ext)
        region_name = ext.connected_region.name
        if ((region_name in connections.keys()) and (connections[region_name] in potentials.keys())):
            for potential in potentials.pop(connections[region_name]):
                enabled[potential] = (region.name, region.dungeon)
        if (ext.connected_region.name in world.inaccessible_regions[player]):
            for new_exit in ext.connected_region.exits:
                if (new_exit not in visited):
                    queue.append(new_exit)