code: def __init__(self, degree, rng):
      if not nx.is_graphical(degree):
          raise nx.NetworkXUnfeasible(
              "degree sequence is not graphical"
          )
      self.rng = rng
      self.degree = list(degree)
      # node labels are integers 0,...,n-1
      self.m = sum(self.degree) / 2.0  # number of edges
      try:
          self.dmax = max(self.degree)  # maximum degree
      except ValueError:
          self.dmax = 0
  
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 to create a new DegreeSequenceRandomGraph object  with example: obj = DegreeSequenceRandomGraph(degree, rng)