code: def mkdirs(
      filename: typing.Union[os.PathLike, str], /, *, mode: int = 0o777
  ) -> None:
      """Recursively create directories up to the path of ``filename``
      as needed."""
      dirname = os.path.dirname(filename)
      if not dirname:
          return
      log.debug("os.makedirs(%r)", dirname)
      os.makedirs(dirname, mode=mode, exist_ok=True)
  
file_path: graphviz/graphviz/_tools.py
imports: import functools
  import inspect
  import itertools
  import logging
  import os
  import pathlib
  import typing
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: mkdirs() without return types