code: def list_roles(args: Namespace) -> None:
      req = bindings.v1SearchRolesAssignableToScopeRequest(
          limit=args.limit,
          offset=args.offset,
          workspaceId=1 if args.exclude_global_roles else None,
      )
      resp = bindings.post_SearchRolesAssignableToScope(
          setup_session(args), body=req
      )
      if args.json:
          determined.cli.render.print_json(resp.to_json())
          return
  
      if resp.roles is None or len(resp.roles) == 0:
          print("no roles found")
          return
      for r in resp.roles:
          print(f"role '{r.name}' with ID {r.roleId} with permissions")
          if r.permissions is None:
              print("role has no permissions assigned")
              continue
  
          render.render_objects(
              v1PermissionHeaders,
              [
                  render.unmarshal(v1PermissionHeaders, p.to_json())
                  for p in r.permissions
              ],
          )
          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 2 for calling a global function with example usage: list_roles(args) without return types