code: def run_notebook(notebook_path):
      with open(notebook_path) as f:
          nb = nbformat.read(f, as_version=4)
  
      proc = ExecutePreprocessor(timeout=600, kernel_name="python3")
      proc.allow_errors = True
      script_path = os.path.dirname(os.path.abspath(__file__))
      package_path = os.path.abspath(
          os.path.join(script_path, "..", "..")
      )
  
      # Add shutdown for show method.
      shutdown_cell = new_code_cell(
          "from interpret import shutdown_show_server\nshutdown_show_server()"
      )
      nb.cells.append(shutdown_cell)
      # In the second cell, enable sampling
      nb.cells[1]["source"] = re.sub(
          "# df = df.sample", "df = df.sample", nb.cells[1]["source"]
      )
      # Set n_jobs to None where appropriate
      for cell in nb.cells:
          cell["source"] = re.sub(
              "n_jobs=-1", "n_jobs=None", cell["source"]
          )
      proc.preprocess(nb, {"metadata": {"path": package_path}})
  
      errors = []
      for cell in nb.cells:
          if "outputs" in cell:
              for output in cell["outputs"]:
                  if output.output_type == "error":
                      errors.append(output)
  
      return nb, errors
  
file_path: interpret/python/interpret-core/tests/test_example_notebooks.py
imports: import os
  import nbformat
  from nbconvert.preprocessors import ExecutePreprocessor
  from nbformat.v4 import new_code_cell
  import pytest
  import re
label_desc: Use image node_id 1 for calling a global function with example usage: run_notebook(notebook_path) and returns: nb,  errors