code: def test_weight_attribute():
      G = nx.Graph()
      G.add_weighted_edges_from([(0, 1, 1.0), (1, 2, 3.5)], weight="w")
      expected = {0: 3.431, 1: 3.082, 2: 5.612}
      b = nx.second_order_centrality(G, weight="w")
  
      for n in sorted(G):
          assert b[n] == pytest.approx(expected[n], abs=1e-2)
  
file_path: networkx/networkx/algorithms/centrality/tests/test_second_order_centrality.py
imports: import pytest
  import networkx
label_desc: Use image node_id 4 for calling a global function with example usage: test_weight_attribute() without return types