code: def nb(tmpdir_factory, request, device_id):
      import nbformat
      import os
      import subprocess
      from cntk.ops.tests.ops_test_utils import cntk_device
      from cntk.cntk_py import DeviceKind_GPU
  
      # tests with Python 2.7 on Windows are not stable in the CI environment
      if os.getenv("OS") == "Windows_NT" and sys.version_info[0] == 2:
          return
  
      inPath = getattr(request.module, "notebook")
  
      deviceIdsToRun = [-1, 0]
      try:
          deviceIdsToRun = getattr(
              request.module, "notebook_deviceIdsToRun"
          )
      except AttributeError:
          pass
  
      timeoutSeconds = 450
      try:
          timeoutSeconds = int(
              getattr(request.module, "notebook_timeoutSeconds")
          )
      except AttributeError:
          pass
  
      # Pass along device_id type to child process
      if cntk_device(device_id).type() == DeviceKind_GPU:
          os.environ["TEST_DEVICE"] = "gpu"
      else:
          os.environ["TEST_DEVICE"] = "cpu"
      if not device_id in deviceIdsToRun:
          pytest.skip(
              "test not configured to run on device ID {0}".format(
                  device_id
              )
          )
      outPath = str(tmpdir_factory.mktemp("notebook").join("out.ipynb"))
      assert os.path.isfile(inPath)
      kernel_name_opt = "--ExecutePreprocessor.kernel_name=python%d" % (
          sys.version_info[0]
      )
      args = [
          "jupyter",
          "nbconvert",
          "--to",
          "notebook",
          "--execute",
          "--ExecutePreprocessor.timeout={0}".format(timeoutSeconds),
          kernel_name_opt,
          "--output",
          outPath,
          inPath,
      ]
      subprocess.check_call(args)
      nb = nbformat.read(outPath, nbformat.current_nbformat)
      return nb
  
imports: import sys
  import pytest
  import cntk.cntk_py
label_desc: Use image node_id 3 for calling a global function with example usage: nb(tmpdir_factory, request, device_id) and returns: nb