code: def get_rng(seed=None):
      
      if seed is None or seed == np.random:
          return np.random.mtrand._rand
      elif isinstance(seed, np.random.RandomState):
          return seed
      try:
          rstate =  np.random.RandomState(seed)
      except ValueError:
          rstate = np.random.RandomState(random.Random(seed).randint(0, 2**32-1))
      return rstate
docs: By default, or if `seed` is np.random, return the global RandomState
      instance used by np.random.
      If `seed` is a RandomState instance, return it unchanged.
      Otherwise, use the passed (hashable) argument to seed a new instance
      of RandomState and return it.
  
      Parameters
      ----------
      seed : hashable or np.random.RandomState or np.random, optional
  
      Returns
      -------
      np.random.RandomState