code: def chunk_and_save(
      data: list, chunk_size: int, data_args: dict, output_dir: str
  ):
      """Divide data into chunks and save it to disk, also saves metadata describing chunking to disk.
  
      Args:
          data (List): List of DataRows and metadata.
          chunk_size (int): number of data elements to store per chunk.
          data_args (Dict): RunConfiguration represented as a dictionary.
          output_dir: phase-specific dir in the output dir specified in the RunConfiguration.
  
      """
      os.makedirs(output_dir, exist_ok=True)
      chunked_data = convert_to_chunks(data=data, chunk_size=chunk_size)
      for i, chunk in enumerate(chunked_data):
          torch.save(
              chunk, os.path.join(output_dir, f"data_{i:05d}.chunk")
          )
      data_args = data_args.copy()
      data_args["num_chunks"] = len(chunked_data)
      data_args["length"] = len(data)
      torch.save(data_args, os.path.join(output_dir, "data_args.p"))
  
imports: import math
  import numpy
  import os
  from typing import Generator, Union, Sequence
  import torch
  import torch.utils.data.dataset
label_desc: Use image node_id 2 for calling a global function with example usage: chunk_and_save(data, chunk_size, data_args, output_dir) without return types