code: def _check_random_state(random_state):
      
      if random_state is None or isinstance(random_state, int):
          return sci.random.RandomState(random_state)
      elif isinstance(random_state, sci.random.RandomState):
          return random_state
      else:
          raise TypeError('Seed should be None, int or np.random.RandomState')
docs: Checks and processes user input for seeding random numbers.
  
      Parameters
      ----------
      random_state : int, RandomState instance or None
          If int, a RandomState instance is created with this integer seed.
          If RandomState instance, random_state is returned;
          If None, a RandomState instance is created with arbitrary seed.
  
      Returns
      -------
      scipy.random.RandomState instance
  
      Raises
      ------
      TypeError
          If ``random_state`` is not appropriately set.