code: def get_root_dir(output_dir=None, new_folder_name=None):
      if not output_dir:
          root_dir = "./"
      elif os.path.isdir(output_dir):
          if new_folder_name:
              root_dir = os.path.join(output_dir, new_folder_name)
              if not os.path.exists(root_dir):
                  os.mkdir(root_dir)
          else:
              root_dir = output_dir
      else:
          raise ValueError(f"{output_dir} is not a valid directory")
      return root_dir
  
file_path: autogluon/multimodal/src/autogluon/multimodal/cli/prepare_detection_dataset.py
imports: import argparse
  import os
  import shutil
  import requests
label_desc: Use image node_id 1 for calling a global function with example usage: get_root_dir(output_dir, new_folder_name) and returns: root_dir