code: def _dkwm_cdf_envelope(n, error_rate, name=None):
      """Computes the CDF envelope that the DKWM inequality licenses.
  
      The [Dvoretzky-Kiefer-Wolfowitz-Massart inequality]
      (https://en.wikipedia.org/wiki/CDF-based_nonparametric_confidence_interval)
      gives a stochastic bound on the distance between the true cumulative
      distribution function (CDF) of any distribution and its empirical
      CDF.  To wit, for `n` iid samples from any distribution with CDF F,
  
      ```none
      P(sup_x |F_n(x) - F(x)| > eps) < 2exp(-2n eps^2)
      ```
  
      This function computes the envelope size `eps` as a function of the
      number of samples `n` and the desired limit on the left-hand
      probability above.
  
      Args:
        n: `Tensor` of numbers of samples drawn.
        error_rate: Floating-point `Tensor` of admissible rates of mistakes.
        name: A name for this operation (optional).
  
      Returns:
        eps: `Tensor` of maximum distances the true CDF can be from the
          empirical CDF.  This scales as `O(sqrt(-log(error_rate)))` and
          as `O(1 / sqrt(n))`.  The shape is the broadcast of `n` and
          `error_rate`.
      """
      with tf.name_scope(name or "dkwm_cdf_envelope"):
          n = tf.cast(n, dtype=error_rate.dtype)
          return tf.sqrt(-tf.math.log(error_rate / 2.0) / (2.0 * n))
  
imports: import functools
  import itertools
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.util.seed_stream import SeedStream
label_desc: Use image node_id 15 for calling a global function with example usage: _dkwm_cdf_envelope(n, error_rate, name) and returns: tf