code: def eulerian_circuit(G, source=None, keys=False):
      """Returns an iterator over the edges of an Eulerian circuit in `G`.
  
      An *Eulerian circuit* is a closed walk that includes each edge of a
      graph exactly once.
  
      Parameters
      ----------
      G : NetworkX graph
         A graph, either directed or undirected.
  
      source : node, optional
         Starting node for circuit.
  
      keys : bool
         If False, edges generated by this function will be of the form
         ``(u, v)``. Otherwise, edges will be of the form ``(u, v, k)``.
         This option is ignored unless `G` is a multigraph.
  
      Returns
      -------
      edges : iterator
         An iterator over edges in the Eulerian circuit.
  
      Raises
      ------
      NetworkXError
         If the graph is not Eulerian.
  
      See Also
      --------
      is_eulerian
  
      Notes
      -----
      This is a linear time implementation of an algorithm adapted from [1]_.
  
      For general information about Euler tours, see [2]_.
  
      References
      ----------
      .. [1] J. Edmonds, E. L. Johnson.
         Matching, Euler tours and the Chinese postman.
         Mathematical programming, Volume 5, Issue 1 (1973), 111-114.
      .. [2] https://en.wikipedia.org/wiki/Eulerian_path
  
      Examples
      --------
      To get an Eulerian circuit in an undirected graph::
  
          >>> G = nx.complete_graph(3)
          >>> list(nx.eulerian_circuit(G))
          [(0, 2), (2, 1), (1, 0)]
          >>> list(nx.eulerian_circuit(G, source=1))
          [(1, 2), (2, 0), (0, 1)]
  
      To get the sequence of vertices in an Eulerian circuit::
  
          >>> [u for u, v in nx.eulerian_circuit(G)]
          [0, 2, 1]
  
      """
      if not is_eulerian(G):
          raise nx.NetworkXError("G is not Eulerian.")
      if G.is_directed():
          G = G.reverse()
      else:
          G = G.copy()
      if source is None:
          source = arbitrary_element(G)
      if G.is_multigraph():
          for u, v, k in _multigraph_eulerian_circuit(G, source):
              if keys:
                  yield u, v, k
              else:
                  yield u, v
      else:
          yield from _simplegraph_eulerian_circuit(G, source)
  
file_path: networkx/networkx/algorithms/euler.py
imports: from itertools import combinations
  import networkx
  from ..utils import arbitrary_element, not_implemented_for
label_desc: Use image node_id 6 for calling a global function with example usage: eulerian_circuit(G, source, keys) without return types