code: def _to_stublist(degree_sequence):
      """Returns a list of degree-repeated node numbers.
  
      ``degree_sequence`` is a list of nonnegative integers representing
      the degrees of nodes in a graph.
  
      This function returns a list of node numbers with multiplicities
      according to the given degree sequence. For example, if the first
      element of ``degree_sequence`` is ``3``, then the first node number,
      ``0``, will appear at the head of the returned list three times. The
      node numbers are assumed to be the numbers zero through
      ``len(degree_sequence) - 1``.
  
      Examples
      --------
  
      >>> degree_sequence = [1, 2, 3]
      >>> _to_stublist(degree_sequence)
      [0, 1, 1, 2, 2, 2]
  
      If a zero appears in the sequence, that means the node exists but
      has degree zero, so that number will be skipped in the returned
      list::
  
      >>> degree_sequence = [2, 0, 1]
      >>> _to_stublist(degree_sequence)
      [0, 0, 2]
  
      """
      return list(
          chaini([n] * d for n, d in enumerate(degree_sequence))
      )
  
imports: import heapq
  import math
  from itertools import chain, combinations, zip_longest
  from operator import itemgetter
  import networkx
  from networkx.utils import py_random_state, random_weighted_sample
label_desc: Use image node_id 1 for calling a global function with example usage: _to_stublist(degree_sequence) and returns: list