code: def test_workspace_delete_notebook() -> None:
      admin_session = api_utils.determined_test_session(admin=True)
  
      # create a workspace using bindings
  
      workspace_resp = bindings.post_PostWorkspace(
          admin_session,
          body=bindings.v1PostWorkspaceRequest(
              name=f"workspace_{uuid.uuid4().hex[:8]}",
          ),
      )
  
      # create a notebook inside the workspace
      created_resp = bindings.post_LaunchNotebook(
          admin_session,
          body=bindings.v1LaunchNotebookRequest(
              workspaceId=workspace_resp.workspace.id
          ),
      )
  
      # check that the notebook exists
      notebook_resp = bindings.get_GetNotebook(
          admin_session, notebookId=created_resp.notebook.id
      )
      assert notebook_resp.notebook.state not in TERMINATING_STATES
  
      # check that the notebook is returned in the list of notebooks
      notebooks_resp = bindings.get_GetNotebooks(
          admin_session, workspaceId=workspace_resp.workspace.id
      )
      nb = next(
          (
              nb
              for nb in notebooks_resp.notebooks
              if nb.id == created_resp.notebook.id
          ),
          None,
      )
      assert nb is not None
  
      with setup_workspaces(admin_session) as [workspace2]:
          # create a notebook inside another workspace
          outside_notebook = bindings.post_LaunchNotebook(
              admin_session,
              body=bindings.v1LaunchNotebookRequest(
                  workspaceId=workspace2.id
              ),
          ).notebook
  
          # delete the workspace
          bindings.delete_DeleteWorkspace(
              admin_session, id=workspace_resp.workspace.id
          )
  
          # check that the other notebook is not terminated
          outside_notebook = bindings.get_GetNotebook(
              admin_session, notebookId=outside_notebook.id
          ).notebook
          assert outside_notebook.state not in TERMINATING_STATES
  
      # check that notebook is terminated or terminating.
      wait_for_ntsc_state(
          admin_session,
          NTSC_Kind.notebook,
          ntsc_id=created_resp.notebook.id,
          predicate=lambda state: state in TERMINATING_STATES,
      )
      notebook_resp = bindings.get_GetNotebook(
          admin_session, notebookId=created_resp.notebook.id
      )
      assert notebook_resp.notebook.state in TERMINATING_STATES
  
      # check that the notebook is not returned in the list of notebooks by default.
      notebooks_resp = bindings.get_GetNotebooks(admin_session)
      nb = next(
          (
              nb
              for nb in notebooks_resp.notebooks
              if nb.id == created_resp.notebook.id
          ),
          None,
      )
      assert nb is None
  
      # the api returns a 404
      with pytest.raises(errors.APIException):
          notebooks_resp = bindings.get_GetNotebooks(
              admin_session, workspaceId=workspace_resp.workspace.id
          )
  
imports: import contextlib
  import os
  import tempfile
  import uuid
  from http import HTTPStatus
  from typing import Generator, List, Optional
  import pytest
  from determined.common import api
  from determined.common.api import authentication, bindings, errors
  from determined.common.api._util import NTSC_Kind, wait_for_ntsc_state
  from determined.common.api.errors import APIException
  from tests import api_utils
  from tests import config
  from tests.cluster.test_users import change_user_password, logged_in_user
  from tests.experiment import run_basic_test, wait_for_experiment_state
  from .test_agent_user_group import _delete_workspace_and_check
  from .test_groups import det_cmd, det_cmd_json
label_desc: Use image node_id 5 for calling a global function with example usage: test_workspace_delete_notebook() without return types