code: def test_weight_key():
      G = nx.Graph()
      G.add_nodes_from([1, 2, 3, 4, 5, 6, 7, 8, 9])
      G.add_edges_from([(3, 8), (1, 2), (2, 3)])
      impossible = {(3, 6), (3, 9)}
      rng = random.Random(0)
      avail_uv = list(set(complement_edges(G)) - impossible)
      avail = [(u, v, {"cost": rng.random()}) for u, v in avail_uv]
  
      _augment_and_check(G, k=1)
      _augment_and_check(G, k=1, avail=avail_uv)
      _augment_and_check(G, k=1, avail=avail, weight="cost")
  
      _check_augmentations(G, avail, weight="cost")
  
imports: import itertools
  import random
  import pytest
  import networkx
  from networkx.algorithms.connectivity import k_edge_augmentation
  from networkx.algorithms.connectivity.edge_augmentation import _unpack_available_edges, collapse, complement_edges, is_k_edge_connected, is_locally_k_edge_connected
  from networkx.utils import pairwise
label_desc: Use image node_id 2 for calling a global function with example usage: test_weight_key() without return types