code: def with_temporary_file(
      func: Callable[[IO[bytes]], None],
      dir: PathLike | None = None,
      suffix: str = "",
  ) -> None:
      """ """
      if dir is None:
          dir = _LOCAL_TMP
  
      # Windows throws a permission denied if we use delete=True for
      # auto-delete, and then try to open the file again ourselves
      # with f.name. So we manually delete in the finally block
      # below.
      f = tempfile.NamedTemporaryFile(
          dir=dir, delete=False, suffix=suffix
      )
      try:
          func(f)
      finally:
          f.close()
          os.remove(f.name)
  
file_path: bokeh/tests/support/util/filesystem.py
imports: from __future__ import annotations
  import logging
  import os
  import shutil
  import sys
  import tempfile
  from contextlib import contextmanager
  from types import TracebackType
  from typing import IO, Awaitable, Callable, ContextManager, Iterator
  from bokeh.core.types import PathLike
label_desc: Use image node_id 3 for calling a global function with example usage: with_temporary_file(func, dir, suffix) without return types