code: def principal_from_username(username, realm):
      """Retrieve principal from the username and realm."""
      if ("@" not in username) and realm:
          username = f"{username}@{realm}"
  
      return username
  
file_path: airflow/airflow/security/utils.py
imports: from __future__ import annotations
  import socket
  import re2
  from airflow.utils.net import get_hostname
label_desc: Use image node_id 4 for calling a global function with example usage: principal_from_username(username, realm) and returns: username