code: def _get_weight_fn(graph) -> Callable:
      fn = (
          _weighted
          if nx.classes.function.is_weighted(graph)
          else _unweighted
      )
  
      return fn
  
imports: import random
  from functools import partial
  from typing import List, Callable
  import numpy
  import networkx
label_desc: Use image node_id 7 for calling a global function with example usage: _get_weight_fn(graph) and returns: fn