code: def _region_2(g1plus2g0, g0plus2g1, g0, g1, x):
      """Computes conditional and value for points in region 2."""
      del g0plus2g1
      # Reference: Eq. 28, 29 in Ref [2]
      is_region_2 = ((g0 < 0) & (g1plus2g0 >= 0)) | (
          (g0 > 0) & (g1plus2g0 <= 0)
      )
      eta = g1plus2g0 / (g1 - g0)
      x_floor = tf.math.maximum(x, eta)
      ratio = (x_floor - eta) / (1 - eta)
      region_2_value = g0 + (g1 - g0) * tf.math.square(ratio)
      # Integral is: g0 x + 1/3 (g1 - g0) (1-eta) [(x-eta)/(1-eta)]^3 for x > eta
      # and g0 x for x < eta.
      coeff = (g1 - g0) * (1 - eta) / 3
      integrated_value = g0 * x + coeff * (ratio**3)
      return is_region_2, region_2_value, integrated_value
  
file_path: tf-quant-finance/tf_quant_finance/rates/hagan_west/monotone_convex.py
imports: import tensorflow.compat.v2
  from tf_quant_finance import types
  from tf_quant_finance.math import piecewise
  from tf_quant_finance.math.diff_ops import diff
  from tf_quant_finance.rates.analytics import forwards
label_desc: Use image node_id 6 for calling a global function with example usage: _region_2(g1plus2g0, g0plus2g1, g0, g1, x) and returns: is_region_2,  region_2_value,  integrated_value