code: def list_users_roles(args: Namespace) -> None:
      session = setup_session(args)
      user_id = api.usernames_to_user_ids(session, [args.username])[0]
      resp = bindings.get_GetRolesAssignedToUser(
          session, userId=user_id
      )
      if args.json:
          determined.cli.render.print_json(resp.to_json())
          return
  
      if resp.roles is None or len(resp.roles) == 0:
          print("user has no role assignments")
          return
  
      output = []
      for r in resp.roles:
          if r.userRoleAssignments is not None:
              for u in r.userRoleAssignments:
                  o = role_with_assignment_to_dict(
                      session, r, u.roleAssignment
                  )
                  o["assignedDirectlyToUser"] = True
                  output.append(o)
          if r.groupRoleAssignments is not None:
              for g in r.groupRoleAssignments:
                  o = role_with_assignment_to_dict(
                      session, r, g.roleAssignment
                  )
                  o["assignedToGroupID"] = g.groupId
                  o["assignedToGroupName"] = bindings.get_GetGroup(
                      session, groupId=g.groupId
                  ).group.name
                  output.append(o)
  
      render.render_objects(
          roleAssignmentHeaders,
          [render.unmarshal(roleAssignmentHeaders, o) for o in output],
      )
  
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 4 for calling a global function with example usage: list_users_roles(args) without return types