code: def callable_discount_factor(t, lower=0.01, upper=0.02):
      # For time dependent rates calculate the discount rate by integrating the risk
      # free rate: exp(-int_0^t r(s) ds)
      return tf.expand_dims(
          tf.where(
              t < 0.5,
              tf.math.exp(-lower * t)
              * tf.ones_like(t, dtype=tf.float64),
              tf.math.exp(-lower * 0.5 - upper * (t - 0.5))
              * tf.ones_like(t, dtype=tf.float64),
          ),
          -1,
      )
  
imports: import functools
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tf_quant_finance.experimental.local_volatility import local_volatility_model
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 4 for calling a global function with example usage: callable_discount_factor(t, lower, upper) and returns: tf