code: def _is_valid_cut(G, set1, set2):
      union = set1.union(set2)
      assert union == set(G.nodes)
      assert len(set1) + len(set2) == G.number_of_nodes()
  
file_path: networkx/networkx/algorithms/approximation/tests/test_maxcut.py
imports: import random
  import pytest
  import networkx
  from networkx.algorithms.approximation import maxcut
label_desc: Use image node_id 2 for calling a global function with example usage: _is_valid_cut(G, set1, set2) without return types