code: def _init_node_labels(G, edge_attr, node_attr):
      if node_attr:
          return {u: str(dd[node_attr]) for u, dd in G.nodes(data=True)}
      elif edge_attr:
          return {u: "" for u in G}
      else:
          return {u: str(deg) for u, deg in G.degree()}
  
file_path: networkx/networkx/algorithms/graph_hashing.py
imports: from collections import Counter, defaultdict
  from hashlib import blake2b
  import networkx
label_desc: Use image node_id 2 for calling a global function with example usage: _init_node_labels(G, edge_attr, node_attr) and returns: unknown, unknown, unknown