code: def save_notebook(nb_str, path, execute=True, parameters=None):
      nb = jupytext.reads(nb_str, fmt="py:light")
      nb.metadata["kernelspec"] = {
          "name": "python3",
          "language": "python",
          "display_name": "Python 3",
      }
  
      Path(path).parent.mkdir(exist_ok=True, parents=True)
  
      nbformat.write(nb, path)
  
      if execute:
          pm.execute_notebook(
              str(path), str(path), parameters=parameters or {}
          )
  
      return str(path)
  
file_path: sklearn-evaluation/tests/nb/conftest.py
imports: from pathlib import Path
  import jupytext
  import nbformat
  import papermill
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: save_notebook(nb_str, path, execute, parameters) and returns: str