code: def _convert_multigraph(G, weight, is_directed):
      """Convert a Multigraph to normal Graph"""
      if is_directed:
          H = nx.DiGraph()
      else:
          H = nx.Graph()
      H.add_nodes_from(G)
      for u, v, wt in G.edges(data=weight, default=1):
          if H.has_edge(u, v):
              H[u][v]["weight"] += wt
          else:
              H.add_edge(u, v, weight=wt)
      return H
  
file_path: networkx/networkx/algorithms/community/louvain.py
imports: from collections import defaultdict, deque
  import networkx
  from networkx.algorithms.community import modularity
  from networkx.utils import py_random_state
label_desc: Use image node_id 6 for calling a global function with example usage: _convert_multigraph(G, weight, is_directed) and returns: H