code: def compute_rdp_from_ledger(ledger, orders):
      """Computes RDP of Sampled Gaussian Mechanism from ledger.
  
      Args:
        ledger: A formatted privacy ledger.
        orders: An array (or a scalar) of RDP orders.
  
      Returns:
        RDP at all orders. Can be `np.inf`.
      """
      total_rdp = np.zeros_like(orders, dtype=float)
      for sample in ledger:
          # Compute equivalent z from l2_clip_bounds and noise stddevs in sample.
          # See https://arxiv.org/pdf/1812.06210.pdf for derivation of this formula.
          effective_z = (
              sum(
                  [
                      (q.noise_stddev / q.l2_norm_bound) ** -2
                      for q in sample.queries
                  ]
              )
              ** -0.5
          )
          total_rdp += compute_rdp(
              sample.selection_probability, effective_z, 1, orders
          )
      return total_rdp
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import sys
  import numpy
  from scipy import special
  import six
label_desc: Use image node_id 21 for calling a global function with example usage: compute_rdp_from_ledger(ledger, orders) and returns: total_rdp