code: def _lookup_user(user_email_or_username: str):
      security_manager = get_airflow_app().appbuilder.sm
      user = security_manager.find_user(
          email=user_email_or_username
      ) or security_manager.find_user(username=user_email_or_username)
      if not user:
          return None
  
      if not user.is_active:
          return None
  
      return user
  
file_path: airflow/tests/test_utils/remote_user_api_auth_backend.py
imports: from __future__ import annotations
  import logging
  from functools import wraps
  from typing import TYPE_CHECKING, Callable, TypeVar, cast
  from flask import Response, request
  from flask_login import login_user
  from airflow.utils.airflow_flask_app import get_airflow_app
label_desc: Use image node_id 2 for calling a global function with example usage: _lookup_user(user_email_or_username) and returns: user, None, None