code: def add_edges(self, G, graph_element):
      if G.is_multigraph():
          for u, v, key, data in G.edges(data=True, keys=True):
              edge_element = self.myElement(
                  "edge",
                  source=str(u),
                  target=str(v),
                  id=str(data.get(self.edge_id_from_attribute))
                  if self.edge_id_from_attribute
                  and self.edge_id_from_attribute in data
                  else str(key),
              )
              default = G.graph.get("edge_default", {})
              self.add_attributes("edge", edge_element, data, default)
              graph_element.append(edge_element)
      else:
          for u, v, data in G.edges(data=True):
              if (
                  self.edge_id_from_attribute
                  and self.edge_id_from_attribute in data
              ):
                  # select attribute to be edge id
                  edge_element = self.myElement(
                      "edge",
                      source=str(u),
                      target=str(v),
                      id=str(data.get(self.edge_id_from_attribute)),
                  )
              else:
                  # default: no edge id
                  edge_element = self.myElement(
                      "edge", source=str(u), target=str(v)
                  )
              default = G.graph.get("edge_default", {})
              self.add_attributes("edge", edge_element, data, default)
              graph_element.append(edge_element)
  
imports: import warnings
  from collections import defaultdict
  import networkx
  from networkx.utils import open_file
label_desc: Use image node_id 8 for calling the GraphMLWriter obj's underlying member method code with example usage: obj.add_edges(G, graph_element) without return types