code: def add_nodes(self, G, graph_element):
      nodes_element = Element("nodes")
      for node, data in G.nodes(data=True):
          node_data = data.copy()
          node_id = str(node_data.pop("id", node))
          kw = {"id": node_id}
          label = str(node_data.pop("label", node))
          kw["label"] = label
          try:
              pid = node_data.pop("pid")
              kw["pid"] = str(pid)
          except KeyError:
              pass
          try:
              start = node_data.pop("start")
              kw["start"] = str(start)
              self.alter_graph_mode_timeformat(start)
          except KeyError:
              pass
          try:
              end = node_data.pop("end")
              kw["end"] = str(end)
              self.alter_graph_mode_timeformat(end)
          except KeyError:
              pass
          # add node element with attributes
          node_element = Element("node", **kw)
          # add node element and attr subelements
          default = G.graph.get("node_default", {})
          node_data = self.add_parents(node_element, node_data)
          if self.VERSION == "1.1":
              node_data = self.add_slices(node_element, node_data)
          else:
              node_data = self.add_spells(node_element, node_data)
          node_data = self.add_viz(node_element, node_data)
          node_data = self.add_attributes(
              "node", node_element, node_data, default
          )
          nodes_element.append(node_element)
      graph_element.append(nodes_element)
  
imports: import itertools
  import time
  from xml.etree.ElementTree import Element, ElementTree, SubElement, register_namespace, tostring
  import networkx
  from networkx.utils import open_file
label_desc: Use image node_id 4 for calling the GEXFWriter obj's underlying member method code with example usage: obj.add_nodes(G, graph_element) without return types