def validate_recipient_user_profiles(user_profiles: Sequence[UserProfile], sender: UserProfile, allow_deactivated: bool=False) -> Sequence[UserProfile]:
    recipient_profiles_map: Dict[(int, UserProfile)] = {}
    realms = set()
    if (not is_cross_realm_bot_email(sender.email)):
        realms.add(sender.realm_id)
    for user_profile in user_profiles:
        if (((not user_profile.is_active) and (not user_profile.is_mirror_dummy) and (not allow_deactivated)) or user_profile.realm.deactivated):
            raise ValidationError(_("'{email}' is no longer using Zulip.").format(email=user_profile.email))
        recipient_profiles_map[user_profile.id] = user_profile
        if (not is_cross_realm_bot_email(user_profile.email)):
            realms.add(user_profile.realm_id)
    if (len(realms) > 1):
        raise ValidationError(_("You can't send private messages outside of your organization."))
    return list(recipient_profiles_map.values())
def validate_recipient_user_profiles(user_profiles: Sequence[UserProfile], sender: UserProfile, allow_deactivated: bool=False) -> Sequence[UserProfile]:
    recipient_profiles_map: Dict[(int, UserProfile)] = {}
    realms = set()
    if (not is_cross_realm_bot_email(sender.email)):
        realms.add(sender.realm_id)
    for user_profile in user_profiles:
        if (((not user_profile.is_active) and (not user_profile.is_mirror_dummy) and (not allow_deactivated)) or user_profile.realm.deactivated):
            raise ValidationError(_("'{email}' is no longer using Zulip.").format(email=user_profile.email))
        recipient_profiles_map[user_profile.id] = user_profile
        if (not is_cross_realm_bot_email(user_profile.email)):
            realms.add(user_profile.realm_id)
    if (len(realms) > 1):
        raise ValidationError(_("You can't send private messages outside of your organization."))
    return list(recipient_profiles_map.values())