docstr: Make a data element for an edge or a node. Keep a log of the
  type in the keys table.
docstr_tok: ["Make","a","data","element","for","an","edge","or","a","node",".","Keep","a","log","of","the","type","in","the","keys","table","."]
code: def add_data(
      self, name, element_type, value, scope="all", default=None
  ):
      """
      Make a data element for an edge or a node. Keep a log of the
      type in the keys table.
      """
      if element_type not in self.xml_type:
          raise nx.NetworkXError(
              f"GraphML writer does not support {element_type} as data values."
          )
      keyid = self.get_key(
          name, self.get_xml_type(element_type), scope, default
      )
      data_element = self.myElement("data", key=keyid)
      data_element.text = str(value)
      return data_element
  
imports: import warnings
  from collections import defaultdict
  import networkx
  from networkx.utils import open_file
label_desc: Use image node_id 5 for calling the GraphMLWriter obj's underlying member method code with example usage: obj.add_data(name, element_type, value, scope, default) and returns: data_element