code: def ensure_directory_exists(dir_names: list):
      main_dir = os.path.join(
          str(fedot_project_root()), dir_names[0], dir_names[1]
      )
      dataset_dir = os.path.join(
          str(fedot_project_root()),
          dir_names[0],
          dir_names[1],
          dir_names[2],
      )
      if not os.path.exists(main_dir):
          os.mkdir(main_dir)
      if not os.path.exists(dataset_dir):
          os.mkdir(dataset_dir)
  
imports: import math
  import os
  import platform
  import random
  import tempfile
  from pathlib import Path
  from typing import Optional, Union
  import numpy
  import pandas
  from golem.utilities.random import RandomStateHandler
  from sklearn.model_selection import train_test_split
label_desc: Use image node_id 8 for calling a global function with example usage: ensure_directory_exists(dir_names) without return types