code: def read_p2g(path, encoding="utf-8"):
      """Read graph in p2g format from path.
  
      Returns
      -------
      MultiDiGraph
  
      Notes
      -----
      If you want a DiGraph (with no self loops allowed and no edge data)
      use D=nx.DiGraph(read_p2g(path))
      """
      lines = (line.decode(encoding) for line in path)
      G = parse_p2g(lines)
      return G
  
imports: import networkx
  from networkx.utils import open_file
label_desc: Use image node_id 2 for calling a global function with example usage: read_p2g(path, encoding) and returns: G