code: def _get_static_predicate(pred):
      """Helper function for statically evaluating predicates in `cond`."""
      pred_value = _get_static_value(pred)
      if pred_value in (
          0,
          1,
          True,
          False,
      ):  # Accept 1/0 as valid boolean values.
          # This branch also casts np.array(False), tf.EagerTensor(True), etc.
          pred_value = bool(pred_value)
      elif pred_value is not None:
          raise TypeError(
              "`pred` must be a Tensor, or a Python bool, or 1 or 0. "
              "Found instead: {}".format(pred)
          )
      return pred_value
  
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 6 for calling a global function with example usage: _get_static_predicate(pred) and returns: pred_value