code: def contrast(image, factor):
      """Equivalent of PIL Contrast."""
      grayscale_im = tf.image.rgb_to_grayscale(image)
      mean = tf.reduce_mean(tf.cast(grayscale_im, tf.float32))
      mean = tf.saturate_cast(mean + 0.5, tf.uint8)
  
      degenerate = tf.ones_like(grayscale_im, dtype=tf.uint8) * mean
      degenerate = tf.image.grayscale_to_rgb(degenerate)
  
      return blend(degenerate, image, factor)
  
imports: import math
  import tensorflow
  import tensorflow_addons
label_desc: Use image node_id 9 for calling a global function with example usage: contrast(image, factor) and returns: blend