code: def get_or_create_data_dir():
      data_dir = user_data_dir("mindsdb", "mindsdb")
      mindsdb_data_dir = os.path.join(data_dir, "var/")
  
      if os.path.exists(mindsdb_data_dir) is False:
          create_directory(mindsdb_data_dir)
  
      try:
          assert os.path.exists(mindsdb_data_dir)
          assert os.access(mindsdb_data_dir, os.W_OK) is True
      except Exception:
          raise Exception(
              "MindsDB storage directory does not exist and could not be created"
          )
  
      return mindsdb_data_dir
  
file_path: mindsdb/mindsdb/utilities/fs.py
imports: import os
  import tempfile
  import threading
  import time
  from pathlib import Path
  from typing import Optional
  import psutil
  from appdirs import user_data_dir
  from mindsdb.utilities import log
label_desc: Use image node_id 3 for calling a global function with example usage: get_or_create_data_dir() and returns: mindsdb_data_dir