def send_peer_remove_event(stream: Stream) -> None:
    if (stream.is_in_zephyr_realm and (not stream.invite_only)):
        return
    altered_users = altered_user_dict[stream.id]
    altered_user_ids = [u.id for u in altered_users]
    subscribed_user_ids = all_subscribers_by_stream[stream.id]
    peer_user_ids = get_peer_user_ids_for_stream_change(stream=stream, altered_user_ids=altered_user_ids, subscribed_user_ids=subscribed_user_ids)
    if peer_user_ids:
        for removed_user in altered_users:
            event = dict(type='subscription', op='peer_remove', stream_id=stream.id, user_id=removed_user.id)
            send_event(our_realm, event, peer_user_ids)
def send_peer_remove_event(stream: Stream) -> None:
    if (stream.is_in_zephyr_realm and (not stream.invite_only)):
        return
    altered_users = altered_user_dict[stream.id]
    altered_user_ids = [u.id for u in altered_users]
    subscribed_user_ids = all_subscribers_by_stream[stream.id]
    peer_user_ids = get_peer_user_ids_for_stream_change(stream=stream, altered_user_ids=altered_user_ids, subscribed_user_ids=subscribed_user_ids)
    if peer_user_ids:
        for removed_user in altered_users:
            event = dict(type='subscription', op='peer_remove', stream_id=stream.id, user_id=removed_user.id)
            send_event(our_realm, event, peer_user_ids)