code: def with_script_contents(contents, func):
      def with_file_object(f):
          nbsource = nbformat.writes(contents)
          f.write(nbsource.encode("UTF-8"))
          f.flush()
          func(f.name)
  
      with_temporary_file(with_file_object)
  
file_path: bokeh/tests/unit/bokeh/application/handlers/test_notebook__handlers.py
imports: from __future__ import annotations
  import pytest
  import nbconvert
  import nbformat
  from packaging import version
  from bokeh.document import Document
  from tests.support.util.filesystem import with_temporary_file
  import bokeh.application.handlers.notebook
label_desc: Use image node_id 1 for calling a global function with example usage: with_script_contents(contents, func) without return types