<｜begin▁of▁sentence｜>### Instruction:
Imagine you're managing the logistics for a courtroom's security system, and you have a network of chambers connected by corridors. Each corridor is assigned a security level that corresponds to how heavily it should be patrolled. The connections look like this:

- Chamber A is connected to Chamber B with a security level of 4.
- Chamber B is connected to Chamber C with a security level of 3.
- Chamber C is connected to Chamber D with a security level of 2.
- Chamber D is connected to Chamber A with a security level of 1.

Now, to optimize our patrolling strategy, we need to evaluate the overall security standing for the neighborhood of each chamber – this means figuring out the average security level of the corridors leading into each adjacent chamber. Could you provide me with that information, keeping in mind that the corridors have different weights (security levels) that influence these averages?
### Response:
import networkx as nx

# Create a weighted undirected graph
G = nx.Graph()
G.add_edge('A', 'B', weight=4)
G.add_edge('B', 'C', weight=3)
G.add_edge('C', 'D', weight=2)
G.add_edge('D', 'A', weight=1)

# Compute the average neighbor degree for all nodes with weights
avg_neighbor_deg = nx.average_neighbor_degree(G, weight='weight')

# Print the average neighbor degree
for node, avg_deg in avg_neighbor_deg.items():
  print(f'Node {node}: {avg_deg}')
<|EOT|>
