code: def ensure_directory_exists(filename: Path | str) -> None:
      """
      Ensure the directory containing the file exists (create it if necessary)
      :param filename: file.
      """
      Path(filename).parent.mkdir(parents=True, exist_ok=True)
  
file_path: catboost/contrib/python/filelock/py3/filelock/_util.py
imports: from __future__ import annotations
  import os
  import stat
  import sys
  from errno import EACCES, EISDIR
  from pathlib import Path
label_desc: Use image node_id 2 for calling a global function with example usage: ensure_directory_exists(filename) without return types