code: def check_random_state(seed):
      """Turn seed into a :class:`numpy.random.RandomState` instance
  
      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.
      """
      import numpy as np
  
      # pylint: disable=W0212
      # pylint: disable=c-extension-no-member
      if seed is None or seed is np.random:
          return (
              np.random.mtrand._rand
          )  # pylint: disable=c-extension-no-member
      if isinstance(seed, (numbers.Integral, np.integer)):
          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: from __future__ import unicode_literals
  import importlib
  import json
  import numbers
  import re
  from builtins import bytes, str
  from datetime import datetime
  from functools import wraps
  from pathlib import Path
  from future.utils import text_type
  from snips_nlu.constants import END, ENTITY_KIND, RES_MATCH_RANGE, RES_VALUE, START
  from snips_nlu.exceptions import NotTrained, PersistingError
label_desc: Use image node_id 2 for calling a global function with example usage: check_random_state(seed) and returns: np, np, seed