code: def create_workspaces_with_users(
      assignments_list: List[List[Tuple[int, List[str]]]]
  ) -> Generator[
      Tuple[
          List[bindings.v1Workspace],
          Dict[int, authentication.Credentials],
      ],
      None,
      None,
  ]:
      """
      Set up workspaces and users with the provided role assignments.
      For example the following sets up 2 workspaces and 2 users referenced
      with the integer ids 1 and 2. User 1 has the roles Editor and Viewer on
      workspace 1 and the role Viewer on workspace 2. User 2 has the role Viewer
      on workspace 1 and no roles on workspace 2.
      perm_assigments = [
          [
              (1, ["Editor", "Viewer"]),
              (2, ["Viewer"]),
          ],
          [
              (1, ["Viewer"]),
          ]
      ]
      """
      sess = api_utils.determined_test_session(admin=True)
      api_utils.configure_token_store(conf.ADMIN_CREDENTIALS)
      rid_to_creds: Dict[int, authentication.Credentials] = {}
      with setup_workspaces(count=len(assignments_list)) as workspaces:
          for workspace, user_list in zip(workspaces, assignments_list):
              for rid, roles in user_list:
                  if rid not in rid_to_creds:
                      rid_to_creds[rid] = api_utils.create_test_user()
                  for role in roles:
                      api_utils.assign_user_role(
                          session=sess,
                          user=rid_to_creds[rid].username,
                          role=role,
                          workspace=workspace.name,
                      )
          yield workspaces, rid_to_creds
  
imports: import contextlib
  from typing import Any, Callable, Dict, Generator, List, NamedTuple, Optional, Tuple
  import pytest
  from determined.common import api
  from determined.common.api import authentication, bindings, errors
  from tests import api_utils
  from tests import config
  from tests.cluster.test_workspace_org import setup_workspaces
  from .test_groups import det_cmd, det_cmd_expect_error, det_cmd_json
  from .test_users import logged_in_user
label_desc: Use image node_id 7 for calling a global function with example usage: create_workspaces_with_users(assignments_list) without return types