code: def cond(pred, true_fn=None, false_fn=None, name=None):
      """Return either `true_fn()` if predicate `pred` is true else `false_fn()`.
  
      If `pred` is a bool or has a constant value, we return either `true_fn()`
      or `false_fn()`, otherwise we use `tf.cond` to dynamically route to both.
  
      Args:
        pred: A scalar determining whether to return the result of `true_fn` or
          `false_fn`.
        true_fn: The callable to be performed if pred is true.
        false_fn: The callable to be performed if pred is false.
        name: Optional name prefix when using `tf.cond`.
  
      Returns:
        Tensors returned by the call to either `true_fn` or `false_fn`.
  
      Raises:
        TypeError: If `true_fn` or `false_fn` is not callable.
      """
      if not callable(true_fn):
          raise TypeError("`true_fn` must be callable.")
      if not callable(false_fn):
          raise TypeError("`false_fn` must be callable.")
  
      pred_value = _get_static_predicate(pred)
      if pred_value is not None:
          if pred_value:
              return true_fn()
          else:
              return false_fn()
      else:
          return tf.cond(
              pred=pred, true_fn=true_fn, false_fn=false_fn, name=name
          )
  
imports: import decorator
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal.backend import numpy
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import control_flow_case
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 11 for calling a global function with example usage: cond(pred, true_fn, false_fn, name) and returns: tf, true_fn, false_fn