docs: def ensure_dir(directory: str) -> None:
      """Create a directory if it doesn't exist."""
      if not os.path.isdir(directory):
          LOG.debug(f"Directory {directory} does not exist, creating it.")
          os.makedirs(directory)