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 networkx
  import numpy
  import pandas
  import pytest
  from flaky import flaky
  from pytest import approx
  from scipy import stats
  from dowhy.gcm import AdditiveNoiseModel, ClassifierFCM, ProbabilisticCausalModel, ScipyDistribution, arrow_strength, fit
  from dowhy.gcm.auto import assign_causal_mechanisms
  from dowhy.gcm.divergence import estimate_kl_divergence_continuous_knn
  from dowhy.gcm.influence import arrow_strength_of_model
  from dowhy.gcm.ml import create_linear_regressor, create_linear_regressor_with_given_parameters, create_logistic_regression_classifier
label_desc: Use image node_id 1 for calling a global function with example usage: preserve_random_generator_state() without return types