code: def exponential_survival_data(n, cr=0.05, scale=1.0):
      t = stats.expon.rvs(scale=scale, size=n)
      if cr == 0.0:
          return t, np.ones(n, dtype=bool)
  
      def pF(h):
          v = 1.0 * h / scale
          return v / (np.exp(v) - 1) - cr
  
      # find the threshold:
      h = newton(pF, 1.0, maxiter=500)
  
      # generate truncated data
      # pylint: disable=invalid-unary-operand-type
      R = (1 - np.exp(-h / scale)) * stats.uniform.rvs(size=n)
      entrance = -np.log(1 - R) * scale
  
      C = (t + entrance) < h  # should occur 1-cr of the time.
      T = np.minimum(h - entrance, t)
      return T, C
  
imports: import numpy
  import pandas
  from scipy import stats
  from scipy.optimize import newton
  from scipy.integrate import cumtrapz
label_desc: Use image node_id 2 for calling a global function with example usage: exponential_survival_data(n, cr, scale) and returns: T,  C, t,  np, unknown