code: def _delete_workspace_and_check(
      sess: Session, w: bindings.v1Workspace, max_ticks: int = 60
  ) -> None:
      resp = bindings.delete_DeleteWorkspace(sess, id=w.id)
      if resp.completed:
          return
  
      for _ in range(max_ticks):
          sleep(1)
          try:
              w = bindings.get_GetWorkspace(sess, id=w.id).workspace
              if w.state == bindings.v1WorkspaceState.DELETE_FAILED:
                  raise errors.DeleteFailedException(w.errorMessage)
              elif w.state == bindings.v1WorkspaceState.DELETING:
                  continue
          except errors.NotFoundException:
              break
  
file_path: determined/e2e_tests/tests/cluster/test_agent_user_group.py
imports: import re
  import uuid
  from time import sleep
  import pytest
  from determined.common.api import Session, bindings, errors
  from determined.common.api.bindings import experimentv1State
  from tests import api_utils, command
  from tests import config
  from tests import experiment
label_desc: Use image node_id 1 for calling a global function with example usage: _delete_workspace_and_check(sess, w, max_ticks) without return types