code: def check_random_state(seed):
      """
      Turn seed into a mt.random.RandomState instance
  
      :param seed:
          If seed is None, return the RandomState singleton used by mt.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.
      :return:
      """
      from . import random as mtrand
      from numpy import random as np_mtrand
  
      if seed is None or seed is mtrand or seed is np_mtrand:
          return mtrand._random_state
      if isinstance(seed, (Integral, np.integer)):
          return mtrand.RandomState(seed)
      if isinstance(seed, np.random.RandomState):
          return mtrand.RandomState.from_numpy(seed)
      if isinstance(seed, mtrand.RandomState):
          return seed
      raise ValueError(
          f"{seed} cannot be used to seed a mt.random.RandomState instance"
      )
  
imports: import inspect
  import itertools
  import operator
  from collections import OrderedDict
  from collections.abc import Iterable
  from functools import lru_cache, reduce, wraps
  from math import ceil
  from numbers import Integral
  from typing import Dict, List, Union
  import numpy
  from ..core import ExecutableTuple, recursive_tile
  from ..utils import lazy_import
  from ..lib.mmh3 import hash_from_buffer
label_desc: Use image node_id 25 for calling a global function with example usage: check_random_state(seed) and returns: mtrand, mtrand, mtrand, seed