code: def _preserve_random_generator_state():
      numpy_state = np.random.get_state()
      random_state = random.getstate()
      yield
      np.random.set_state(numpy_state)
      random.setstate(random_state)
  
imports: import random
  import numpy
  import pytest
  from flaky import flaky
  from dowhy.gcm.independence_test import approx_kernel_based, kernel_based
label_desc: Use image node_id 23 for calling a global function with example usage: _preserve_random_generator_state() without return types