code: def generate_every_dataset_summary_table(
      summaries_by_dataset: Dict[
          str, Union[pandas.DataFrame, Dict[str, pandas.DataFrame]]
      ],
      summary_column: str,
      out_dir: str,
  ):
      out_path = os.path.join(out_dir, "seq_summary_granular.csv")
      with open(out_path, "w") as f:
          over_datasets = pandas.concat(
              [
                  sections["baselines"].rename(
                      columns={summary_column: name}
                  )
                  for name, sections in summaries_by_dataset.items()
                  if sections is not None
              ],
              axis=1,
          )
          f.write(over_datasets.to_csv())
  
          for section in (
              "ROSCOE-SA",
              "ROSCOE-SS",
              "ROSCOE-LI",
              "ROSCOE-LC",
          ):
              if section in {"ROSCOE-SA", "ROSCOE-SS"}:
                  for model in MODELS:
                      over_datasets = pandas.concat(
                          [
                              sections[section][model]
                              .loc[ROSCOE_SECTIONS[section]]
                              .rename(columns={summary_column: name})
                              for name, sections in summaries_by_dataset.items()
                              if sections is not None
                          ],
                          axis=1,
                      )
                      f.write(f"{section} - {model}\n")
                      f.write(over_datasets.to_csv(header=False))
              else:
                  over_datasets = pandas.concat(
                      [
                          sections[section]
                          .loc[ROSCOE_SECTIONS[section]]
                          .rename(columns={summary_column: name})
                          for name, sections in summaries_by_dataset.items()
                          if sections is not None
                      ],
                      axis=1,
                  )
                  f.write(f"{section}\n")
                  f.write(over_datasets.to_csv(header=False))
  
      print(f"Summary written to: {out_path}")
  
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 23 for calling a global function with example usage: generate_every_dataset_summary_table(summaries_by_dataset, summary_column, out_dir) without return types