code: def is_k_regular(G, k):
      """Determines whether the graph ``G`` is a k-regular graph.
  
      A k-regular graph is a graph where each vertex has degree k.
  
      Parameters
      ----------
      G : NetworkX graph
  
      Returns
      -------
      bool
          Whether the given graph is k-regular.
  
      Examples
      --------
      >>> G = nx.Graph([(1, 2), (2, 3), (3, 4), (4, 1)])
      >>> nx.is_k_regular(G, k=3)
      False
  
      """
      return all(d == k for n, d in G.degree)
  
imports: import networkx
  from networkx.utils import not_implemented_for
label_desc: Use image node_id 2 for calling a global function with example usage: is_k_regular(G, k) and returns: all