code: def _export_graph_to_tuple_list(
      graph,
      use_vids: bool = True,
      edge_attrs: Union[str, Sequence[str]] = None,
      vertex_name_attr: str = "name",
  ):
      """Export graph to a list of edge tuples
  
      This function is the reverse of Graph.TupleList.
  
      Example:
  
        >>> g = Graph.Full(3)
        >>> g.vs["name"] = ["apple", "pear", "peach"]
        >>> g.es["name"] = ["first_edge", "second", "third"]
  
        >>> # Get name of the edge
        >>> g.to_tuple_list(edge_attrs=["name"])
        [(0, 1, "first_edge"), (0, 2, "second"), (1, 2, "third")]
  
        >>> # Use vertex names, no edge attributes
        >>> g.to_tuple_list(use_vids=False)
        [("apple", "pear"), ("apple", "peach"), ("pear", "peach")]
  
      @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 edge_attrs: list of edge attributes to export
        in addition to source and target vertex, which are always the first two
        elements of each tuple. None (default) is equivalent to an empty list. A
        string is acceptable to signify a single attribute and will be wrapped in
        a list internally.
      @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 list of tuples, each representing an edge of the graph.
      """
      # Output data structure
      res = []
  
      if edge_attrs is not None:
          if isinstance(edge_attrs, str):
              edge_attrs = [edge_attrs]
          missing_attrs = list(
              set(edge_attrs) - set(graph.edge_attributes())
          )
          if missing_attrs:
              raise AttributeError(
                  f"Missing attributes: {missing_attrs}"
              )
      else:
          edge_attrs = []
  
      if use_vids is False:
          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 edge in graph.es:
          source, target = edge.tuple
          if not use_vids:
              source, target = vs_names[source], vs_names[target]
          attrlist = [source, target]
          attrlist += [edge[attrname] for attrname in edge_attrs]
          res.append(tuple(attrlist))
  
      return res
  
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 7 for calling a global function with example usage: _export_graph_to_tuple_list(graph, use_vids, edge_attrs, vertex_name_attr) and returns: res