code: def describe_role(args: Namespace) -> None:
      session = setup_session(args)
      role_id = api.role_name_to_role_id(session, args.role_name)
      req = bindings.v1GetRolesByIDRequest(roleIds=[role_id])
      resp = bindings.post_GetRolesByID(session, body=req)
      if args.json:
          determined.cli.render.print_json(
              resp.roles[0].to_json() if resp.roles else None
          )
          return
  
      if resp.roles is None or len(resp.roles) != 1:
          raise api.errors.BadRequestException(
              f"could not find role name {args.role_name}"
          )
  
      role = resp.roles[0].role
      if role is None:
          raise api.errors.BadResponseException(
              "expected role to be provided"
          )
  
      print(
          f"role '{role.name}' with ID {role.roleId} with permissions"
      )
      if role.permissions is None:
          print("role has no permissions assigned")
      else:
          render.render_objects(
              v1PermissionHeaders,
              [
                  render.unmarshal(v1PermissionHeaders, p.to_json())
                  for p in role.permissions
              ],
          )
          print()
  
      group_assignments = resp.roles[0].groupRoleAssignments
      if group_assignments is None or len(group_assignments) == 0:
          print("role is not assigned to any group")
      else:
          print("role is assigned to groups")
          output = []
          for group_assignment in group_assignments:
              workspace_id = (
                  group_assignment.roleAssignment.scopeWorkspaceId
              )
              workspace_name = None
              group_name = bindings.get_GetGroup(
                  session, groupId=group_assignment.groupId
              ).group.name
              if workspace_id is not None:
                  workspace_name = bindings.get_GetWorkspace(
                      session, id=workspace_id
                  ).workspace.name
  
              output.append(
                  {
                      "groupID": group_assignment.groupId,
                      "groupName": group_name,
                      "workspaceID": workspace_id,
                      "workspaceName": workspace_name,
                      "assignedGlobally": workspace_id is None,
                  }
              )
          render.render_objects(
              groupAssignmentHeaders,
              [
                  render.unmarshal(groupAssignmentHeaders, o)
                  for o in output
              ],
          )
          print()
  
      user_assignments = resp.roles[0].userRoleAssignments
      if user_assignments is None or len(user_assignments) == 0:
          print("role is not assigned to any users")
      else:
          print("role is assigned to users")
          output = []
          for user_assignment in user_assignments:
              workspace_id = (
                  user_assignment.roleAssignment.scopeWorkspaceId
              )
              workspace_name = None
              username = bindings.get_GetUser(
                  session, userId=user_assignment.userId
              ).user.username
              if workspace_id is not None:
                  workspace_name = bindings.get_GetWorkspace(
                      session, id=workspace_id
                  ).workspace.name
  
              output.append(
                  {
                      "userID": user_assignment.userId,
                      "username": username,
                      "workspaceID": workspace_id,
                      "workspaceName": workspace_name,
                      "assignedGlobally": workspace_id is None,
                  }
              )
  
          render.render_objects(
              userAssignmentHeaders,
              [
                  render.unmarshal(userAssignmentHeaders, o)
                  for o in output
              ],
          )
          print()
  
file_path: determined/harness/determined/cli/rbac.py
imports: from argparse import Namespace
  from collections import namedtuple
  from typing import Any, Dict, List, Set, Tuple
  import determined.cli.render
  from determined.cli import default_pagination_args, render, require_feature_flag, setup_session
  from determined.common import api
  from determined.common.api import authentication, bindings
  from determined.common.declarative_argparse import Arg, Cmd
label_desc: Use image node_id 6 for calling a global function with example usage: describe_role(args) without return types