def METHOD_NAME(
    realm: Realm,
    user_email_to_add: str,
    role: int,
) -> None:
    try:
        if role == UserProfile.ROLE_GUEST:
            check_spare_licenses_available_for_adding_new_users(realm, extra_guests_count=1)
        else:
            check_spare_licenses_available_for_adding_new_users(realm, extra_non_guests_count=1)
    except LicenseLimitError:
        send_user_unable_to_signup_message_to_signup_notification_stream(realm, user_email_to_add)
        raise