code: def prepare_output_dirs(cfg: HFDatasetConversionConfig):
      """
      Prepare output directories and subfolders as needed.
      Also prepare the arguments of the config with these directories.
      """
      output_dir = os.path.abspath(cfg.output_dir)
      output_dir = os.path.join(output_dir, cfg.path)
  
      if cfg.name is not None:
          output_dir = os.path.join(output_dir, cfg.name)
  
      if not os.path.exists(output_dir):
          os.makedirs(output_dir, exist_ok=True)
  
      cfg.resolved_output_dir = output_dir
      cfg.split_output_dir = None
  
imports: import json
  import os
  import traceback
  from dataclasses import dataclass, is_dataclass
  from typing import Optional
  import hydra
  import librosa
  import soundfile
  import tqdm
  from datasets import Audio, Dataset, IterableDataset, load_dataset
  from hydra.conf import HydraConf, RunDir
  from hydra.core.config_store import ConfigStore
  from omegaconf import OmegaConf
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_output_dirs(cfg) without return types