code: def random_seed(seed=42):
      
      old_state = random.getstate()
      random.seed(seed)
      try:
          yield
      finally:
          random.setstate(old_state)
docs: sets the random seed of Python within the context.
  
      Example
      -------
      >>> import random
      >>> with random_seed(seed=0):
      ...    random.randint(0, 1000) # doctest: +SKIP
      864