code: def _apply_func_with_prob(func, image, args, prob):
      """Apply `func` to image w/ `args` as input with probability `prob`."""
      assert isinstance(args, tuple)
  
      # If prob is a function argument, then this randomness is being handled
      # inside the function, so make sure it is always called.
      # pytype:disable=wrong-arg-types
      if "prob" in inspect.getfullargspec(func).args:
          prob = 1.0
      # pytype:enable=wrong-arg-types
  
      # Apply the function with probability `prob`.
      should_apply_op = tf.cast(
          tf.floor(tf.random_uniform([], dtype=tf.float32) + prob),
          tf.bool,
      )
      augmented_image = tf.cond(
          should_apply_op, lambda: func(image, *args), lambda: image
      )
      return augmented_image
  
imports: import dataclasses
  import inspect
  import math
  import tensorflow.compat.v1
  from tensorflow_addons import image
label_desc: Use image node_id 30 for calling a global function with example usage: _apply_func_with_prob(func, image, args, prob) and returns: augmented_image