code: def _embed_no_none_gradient_check(value_and_gradients_fn):
      """Wraps value and gradients function to assist with None gradients."""
  
      @functools.wraps(value_and_gradients_fn)
      def func_wrapped(*args, **kwargs):
          """Wrapped function which checks for None gradients."""
          value, grads = value_and_gradients_fn(*args, **kwargs)
          if any(grad is None for grad in grads):
              raise ValueError(
                  "Gradient is None for a state.",
                  args,
                  kwargs,
                  value,
                  grads,
              )
          return value, grads
  
      return func_wrapped
  
imports: import collections
  import functools
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python import random
  from tensorflow_probability.python.experimental import auto_batching
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.mcmc import kernel
  from tensorflow_probability.python.util.seed_stream import SeedStream
label_desc: Use image node_id 2 for calling a global function with example usage: _embed_no_none_gradient_check(value_and_gradients_fn) and returns: func_wrapped, value,  grads