code: def export_legend(
      ori_fig, filename="any_time_legend", colnum=9, unique_labels=None
  ):
      if unique_labels is None:
          unique_labels = []
      fig2 = plt.figure(figsize=(5, 0.3))
      lines_labels = [
          ax.get_legend_handles_labels() for ax in ori_fig.axes
      ]
      lines, labels = [sum(lol, []) for lol in zip(*lines_labels)]
      # grab unique labels
      if len(unique_labels) == 0:
          unique_labels = set(labels)
      # assign labels and legends in dict
      legend_dict = dict(zip(labels, lines))
      # query dict based on unique labels
      unique_lines = [legend_dict[x] for x in unique_labels]
      fig2.legend(
          unique_lines,
          unique_labels,
          loc="center",
          ncol=colnum,
          fancybox=True,
          shadow=True,
          scatterpoints=1,
          fontsize=set_lgend_size,
      )
      fig2.tight_layout()
      fig2.savefig(f"{filename}.pdf", bbox_inches="tight")
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/ml/model_selection/exps/draw_tab_lib.py
imports: from typing import List
  import numpy
  from matplotlib import pyplot
  from matplotlib.ticker import MaxNLocator
  import warnings
  import matplotlib.cbook
  import seaborn
  import matplotlib.pyplot
label_desc: Use image node_id 3 for calling a global function with example usage: export_legend(ori_fig, filename, colnum, unique_labels) without return types