code: def nodes_with_selfloops(G):
      """Returns an iterator over nodes with self loops.
  
      A node with a self loop has an edge with both ends adjacent
      to that node.
  
      Returns
      -------
      nodelist : iterator
          A iterator over nodes with self loops.
  
      See Also
      --------
      selfloop_edges, number_of_selfloops
  
      Examples
      --------
      >>> G = nx.Graph()  # or DiGraph, MultiGraph, MultiDiGraph, etc
      >>> G.add_edge(1, 1)
      >>> G.add_edge(1, 2)
      >>> list(nx.nodes_with_selfloops(G))
      [1]
  
      """
      return (n for n, nbrs in G.adj.items() if n in nbrs)
  
imports: from collections import Counter
  from itertools import chain
  import networkx
  from networkx.utils import not_implemented_for, pairwise
label_desc: Use image node_id 34 for calling a global function with example usage: nodes_with_selfloops(G) and returns: unknown