code: def main(args):
      # make sure output directory exists
      pathlib.Path(os.path.dirname(args.out_dir)).mkdir(
          parents=True, exist_ok=True
      )
  
      dataset_list = (
          list(DATASET_TO_CONFIG.keys())
          if args.dataset == "all"
          else [args.dataset]
      )
      summaries_by_dataset = {}
      for dataset_name in dataset_list:
          print(f"Dataset: {dataset_name}")
          summaries_by_dataset[
              dataset_name
          ] = generate_scores_and_correls_for_dataset(
              dataset_name=dataset_name,
              out_dir=args.out_dir,
              reference_option=args.reference_scores,
              include_baselines=args.include_baselines,
          )
      generate_every_dataset_summary_table(
          summaries_by_dataset={
              m: s for m, (s, _) in summaries_by_dataset.items()
          },
          summary_column="MAX",
          out_dir=args.out_dir,
      )
      if args.dataset == "all":
          write_every_dataset_summary_table_tex(
              summaries_by_dataset={
                  m: s for m, (s, _) in summaries_by_dataset.items()
              },
              out_dir=args.out_dir,
          )
      generate_every_dataset_final_summary_table(
          summaries_by_dataset={
              m: s for m, (_, s) in summaries_by_dataset.items()
          },
          summary_column="MAX",
          out_dir=args.out_dir,
      )
      if args.dataset == "all":
          write_every_dataset_final_summary_table_tex(
              summaries_by_dataset={
                  m: s for m, (_, s) in summaries_by_dataset.items()
              },
              out_dir=args.out_dir,
          )
  
imports: import argparse
  from collections import defaultdict
  import csv
  import math
  import os
  import pathlib
  from typing import Dict, Iterable, List, Optional, Set, Tuple, Union
  import pandas
  from projects.roscoe.meta_evaluation.correlations import Analyzer
  from projects.roscoe.score import ROSCOE_SA, ROSCOE_SS, ROSCOE_LI, ROSCOE_LC, SUPERVISED_SCORES, UNSUPERVISED_SCORES
  from projects.roscoe.utils import assert_all_elements_same_length, ordered_union, split_list
  from projects.roscoe.meta_evaluation.table_file_writing import ANNOTATION_COLUMN_ORDER, COLUMN_RENAMES, MODELS, ROSCOE_SECTIONS, STEP_COLUMN_RENAMES, section_rows, write_every_dataset_summary_table_tex, write_every_dataset_final_summary_table_tex, write_granular_summary_tex
label_desc: Use image node_id 39 for calling a global function with example usage: main(args) without return types