code: def create_user_assignment_request(
      session: api.Session,
      user: str,
      role: str,
      workspace: Optional[str] = None,
  ) -> List[bindings.v1UserRoleAssignment]:
      role_obj = bindings.v1Role(
          roleId=role_name_to_role_id(session, role)
      )
      workspace_id = None
      if workspace is not None:
          workspace_id = workspace_by_name(session, workspace).id
      role_assign = bindings.v1RoleAssignment(
          role=role_obj, scopeWorkspaceId=workspace_id
      )
      user_id = usernames_to_user_ids(session, [user])[0]
      return [
          bindings.v1UserRoleAssignment(
              userId=user_id, roleAssignment=role_assign
          )
      ]
  
file_path: determined/harness/determined/common/api/_rbac.py
imports: from typing import Dict, List, Optional
  from determined.common import api
  from determined.common.api import bindings
label_desc: Use image node_id 2 for calling a global function with example usage: create_user_assignment_request(session, user, role, workspace) and returns: list