code: def latex_table_certified_accuracy_upper_envelope(
      outfile: str,
      radius_start: float,
      radius_stop: float,
      radius_step: float,
      methods: List[Line] = None,
      clean_accuracy=True,
  ):
      accuracies, radii = _get_accuracies_at_radii(
          methods, radius_start, radius_stop, radius_step
      )
      clean_accuracies, _ = _get_accuracies_at_radii(
          methods, 0, 0, 0.25
      )
      assert clean_accuracies.shape[1] == 1
  
      f = open(outfile, "w")
  
      f.write("$\ell_2$ Radius")
      for radius in radii:
          f.write("& ${:.3}$".format(radius))
      f.write("\\\\\n")
  
      f.write("\midrule\n")
  
      clean_accuracies = np.nan_to_num(clean_accuracies, -1)
      accuracies = np.nan_to_num(accuracies, -1)
      for j, radius in enumerate(radii):
          argmaxs = np.argwhere(
              accuracies[:, j] == accuracies[:, j].max()
          )
          argmaxs = argmaxs.flatten()
          i = argmaxs[clean_accuracies[argmaxs, 0].argmax()]
          # i = i.flatten()[0]
          if clean_accuracy:
              txt = (
                  " & $^{("
                  + "{:.2f})".format(clean_accuracies[i, 0])
                  + "}"
                  + "${:.2f}".format(accuracies[i, j])
              )
          else:
              txt = " & {:.2f}".format(accuracies[i, j])
          f.write(txt)
      f.write("\\\\\n")
      f.close()
  
imports: from easydict import EasyDict
  from typing import *
  import math
  import matplotlib
  import matplotlib.pyplot
  import numpy
  import os
  import pandas
  import seaborn
label_desc: Use image node_id 5 for calling a global function with example usage: latex_table_certified_accuracy_upper_envelope(outfile, radius_start, radius_stop, radius_step, methods, clean_accuracy) without return types