code: def get_seeder_and_restorer(seed=0):
      """Return a pair of functions which respectively seed all and restore
      the state of all registered PRNGs.
  
      This is used by the core engine via `deterministic_PRNG`, and by users
      via `register_random`.  We support registration of additional random.Random
      instances (or other objects with seed, getstate, and setstate methods)
      to force determinism on simulation or scheduling frameworks which avoid
      using the global random state.  See e.g. #1709.
      """
      assert isinstance(seed, integer_types) and 0 <= seed < 2**32
      states = []  # type: list
  
      if "numpy" in sys.modules and not any(
          isinstance(x, NumpyRandomWrapper) for x in RANDOMS_TO_MANAGE
      ):
          RANDOMS_TO_MANAGE.append(NumpyRandomWrapper())
  
      def seed_all():
          assert not states
          for r in RANDOMS_TO_MANAGE:
              states.append(r.getstate())
              r.seed(seed)
  
      def restore_all():
          assert len(states) == len(RANDOMS_TO_MANAGE)
          for r, state in zip(RANDOMS_TO_MANAGE, states):
              r.setstate(state)
          del states[:]
  
      return seed_all, restore_all
  
file_path: catboost/contrib/python/hypothesis/py2/hypothesis/internal/entropy.py
imports: from __future__ import absolute_import, division, print_function
  import contextlib
  import random
  import sys
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.compat import integer_types
label_desc: Use image node_id 2 for calling a global function with example usage: get_seeder_and_restorer(seed) and returns: seed_all,  restore_all