code: def get_rng_state() -> Dict[str, Any]:
      rng_state = {
          "np_rng_state": np.random.get_state(),
          "random_rng_state": random.getstate(),
      }
  
      if (
          version.parse(tf.__version__) < version.parse("2.0.0")
          or not tf.executing_eagerly()
      ):
          rng_state[
              "tf_rng_global_seed"
          ] = tf.compat.v1.random.get_seed(0)[0]
      else:
          generator = tf.random.get_global_generator()
          rng_state["tf2_rng_global_algorithm"] = generator.algorithm
          rng_state["tf2_rng_global_state"] = generator.state
  
      return rng_state
  
imports: import random
  from typing import Any, Dict
  import numpy
  import tensorflow
  from packaging import version
label_desc: Use image node_id 1 for calling a global function with example usage: get_rng_state() and returns: rng_state