code: def smart_cond(pred, fn1, fn2, name=None):
      """Return either fn1() or fn2() based on the boolean predicate/value `pred`.
  
      If `pred` is bool or has a constant value it would use `static_cond`,
      otherwise it would use `tf.cond`.
  
      Args:
        pred: A scalar determining whether to return the result of `fn1` or `fn2`.
        fn1: The callable to be performed if pred is true.
        fn2: 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 `fn1` or `fn2`.
      """
      pred_value = constant_value(pred)
      if pred_value is not None:
          # Use static_cond if pred has a constant value.
          return static_cond(pred_value, fn1, fn2)
      else:
          # Use dynamic cond otherwise.
          return control_flow_ops.cond(pred, fn1, fn2, name)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from collections import namedtuple
  from collections import OrderedDict
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import variables
label_desc: Use image node_id 8 for calling a global function with example usage: smart_cond(pred, fn1, fn2, name) and returns: static_cond, control_flow_ops