code: def role_with_assignment_to_dict(
      session: api.Session,
      r: bindings.v1RoleWithAssignments,
      assignment: bindings.v1RoleAssignment,
  ) -> Dict[str, Any]:
      scope_cluster = assignment.scopeCluster
      workspace_id = assignment.scopeWorkspaceId
      workspace_name = None
      if workspace_id is not None:
          workspace_name = bindings.get_GetWorkspace(
              session, id=workspace_id
          ).workspace.name
  
      if not r.role:  # This should not happen.
          return {}
      return {
          "roleName": r.role.name,
          "roleID": r.role.roleId,
          "assignedDirectlyToUser": False,
          "assignedToGroupID": None,
          "assignedToGroupName": None,
          "scopeCluster": scope_cluster,
          "scopeWorkspaceID": workspace_id,
          "scopeWorkspaceName": workspace_name,
      }
  
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 3 for calling a global function with example usage: role_with_assignment_to_dict(session, r, assignment) and returns: dict, dict