code: def _export_graph_to_dict_list(
      graph,
      use_vids: bool = True,
      skip_none: bool = False,
      vertex_name_attr: str = "name",
  ):
      """Export graph as two lists of dictionaries, for vertices and edges.
  
      This function is the reverse of Graph.DictList.
  
      Example:
  
        >>> g = Graph([(0, 1), (1, 2)])
        >>> g.vs["name"] = ["apple", "pear", "peach"]
        >>> g.es["name"] = ["first_edge", "second"]
  
        >>> g.to_dict_list()
        ([{"name": "apple"}, {"name": "pear"}, {"name": "peach"}],
         [{"source": 0, "target": 1, "name": "first_edge"},
          {"source" 0, "target": 2, name": "second"}])
  
        >>> g.to_dict_list(use_vids=False)
        ([{"name": "apple"}, {"name": "pear"}, {"name": "peach"}],
         [{"source": "apple", "target": "pear", "name": "first_edge"},
          {"source" "apple", "target": "peach", name": "second"}])
  
      @param use_vids: whether to label vertices in the output data
        structure by their ids or their vertex_name_attr attribute. If
        use_vids=False but vertices lack a vertex_name_attr attribute, an
        AttributeError is raised.
      @param skip_none: whether to skip, for each edge, attributes that
        have a value of None. This is useful if only some edges are expected to
        possess an attribute.
      @param vertex_name_attr: only used with use_vids=False to choose what
        vertex attribute to use to name your vertices in the output data
        structure.
  
      @return: a tuple with two lists of dictionaries, representing the vertices
        and the edges, respectively, with their attributes.
      """
      # Output data structures
      res_vs, res_es = [], []
  
      if not use_vids:
          if vertex_name_attr not in graph.vertex_attributes():
              raise AttributeError(
                  f"No vertex attribute {vertex_name_attr}"
              )
  
          vs_names = graph.vs[vertex_name_attr]
  
      for vertex in graph.vs:
          if skip_none:
              attrdic = {
                  k: v for k, v in vertex.attributes() if v is not None
              }
          else:
              attrdic = vertex.attributes()
          res_vs.append(attrdic)
  
      for edge in graph.es:
          source, target = edge.tuple
          if not use_vids:
              source, target = vs_names[source], vs_names[target]
          if skip_none:
              attrdic = {
                  k: v for k, v in edge.attributes() if v is not None
              }
          else:
              attrdic = edge.attributes()
  
          attrdic["source"] = source
          attrdic["target"] = target
          res_es.append(attrdic)
  
      return (res_vs, res_es)
  
file_path: python-igraph/src/igraph/io/objects.py
imports: from typing import Union, Sequence
  from collections import defaultdict
  from itertools import repeat
  from warnings import warn
  from igraph.datatypes import UniqueIdGenerator
label_desc: Use image node_id 6 for calling a global function with example usage: _export_graph_to_dict_list(graph, use_vids, skip_none, vertex_name_attr) and returns: res_vs,  res_es