code: def usernames_to_user_ids(
      session: api.Session, usernames: List[str]
  ) -> List[int]:
      usernames_to_ids: Dict[str, Optional[int]] = {
          u: None for u in usernames
      }
      users = bindings.get_GetUsers(session).users or []
      for user in users:
          if user.username in usernames_to_ids:
              usernames_to_ids[user.username] = user.id
  
      missing_users = []
      user_ids = []
      for username, user_id in usernames_to_ids.items():
          if user_id is None:
              missing_users.append(username)
          else:
              user_ids.append(user_id)
  
      if missing_users:
          raise api.errors.BadRequestException(
              f"could not find users for usernames {', '.join(missing_users)}"
          )
      return user_ids
  
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 4 for calling a global function with example usage: usernames_to_user_ids(session, usernames) and returns: user_ids