code: def check_random_state(seed):
      """Turn seed into a np.random.RandomState instance.
  
      Parameters
      ----------
      seed : None, int or instance of RandomState
          If seed is None, return the RandomState singleton used by np.random.
          If seed is an int, return a new RandomState instance seeded with seed.
          If seed is already a RandomState instance, return it.
          Otherwise raise ValueError.
  
      Returns
      -------
      :class:`numpy:numpy.random.RandomState`
          The random state object based on `seed` parameter.
      """
      if seed is None or seed is np.random:
          return np.random.mtrand._rand
      if isinstance(seed, numbers.Integral):
          return np.random.RandomState(seed)
      if isinstance(seed, np.random.RandomState):
          return seed
      raise ValueError(
          "%r cannot be used to seed a numpy.random.RandomState instance"
          % seed
      )
  
imports: import numbers
  import operator
  import sys
  import warnings
  from contextlib import suppress
  from functools import reduce, wraps
  from inspect import Parameter, isclass, signature
  import joblib
  import numpy
  import scipy.sparse
  from ..None import get_config
  from ..exceptions import DataConversionWarning, NotFittedError, PositiveSpectrumWarning
  from ..utils._array_api import _asarray_with_order, _is_numpy_namespace, get_namespace
  from ..utils.fixes import ComplexWarning, _preserve_dia_indices_dtype
  from ._isfinite import FiniteStatus, cy_isfinite
  from .fixes import _object_dtype_isnan
label_desc: Use image node_id 25 for calling a global function with example usage: check_random_state(seed) and returns: np, np, seed