code: def _set_random_states(estimator, random_state=None):
      """Sets fixed random_state parameters for an estimator. Internal use only.
      Modified from sklearn/base.py
  
      Finds all parameters ending ``random_state`` and sets them to integers
      derived from ``random_state``.
  
      Parameters
      ----------
      estimator : estimator supporting get/set_params
          Estimator with potential randomness managed by random_state
          parameters.
  
      random_state : int, RandomState instance or None, optional (default=None)
          If int, random_state is the seed used by the random number generator;
          If RandomState instance, random_state is the random number generator;
          If None, the random number generator is the RandomState instance used
          by `np.random`.
  
      Notes
      -----
      This does not necessarily set *all* ``random_state`` attributes that
      control an estimator's randomness, only those accessible through
      ``estimator.get_params()``.  ``random_state``s not controlled include
      those belonging to:
  
          * cross-validation splitters
          * ``scipy.stats`` rvs
      """
      random_state = check_random_state(random_state)
      to_set = {}
      for key in sorted(estimator.get_params(deep=True)):
          if key == "random_state" or key.endswith("__random_state"):
              to_set[key] = random_state.randint(MAX_INT)
  
      if to_set:
          estimator.set_params(**to_set)
  
imports: from __future__ import division
  from __future__ import print_function
  import numbers
  import numpy
  from sklearn.base import clone
  from sklearn.utils import check_array
  from sklearn.utils import check_random_state
  from sklearn.utils.validation import check_is_fitted
  from .base import BaseDetector
  from .combination import average, maximization
  from .lof import LOF
  from ..utils.utility import check_detector
  from ..utils.utility import check_parameter
  from ..utils.utility import generate_bagging_indices
label_desc: Use image node_id 1 for calling a global function with example usage: _set_random_states(estimator, random_state) without return types