def METHOD_NAME(room):
    emails = set(room.notification_emails)
    if (rb_user_settings.get(room.owner, 'email_mode') in (RoomEmailMode.owned, RoomEmailMode.all)
            and room not in rb_user_settings.get(room.owner, 'email_blacklist')):
        emails.add(room.owner.email)
    # skip people who don't want manager emails
    email_mode_filter = and_(
        UserSetting.name == 'email_mode',
        UserSetting.value[()].astext.in_([RoomEmailMode.none.name, RoomEmailMode.owned.name])
    )
    # skip people who don't want emails for the room
    room_blacklist_filter = and_(
        UserSetting.name == 'email_blacklist',
        UserSetting.value.contains(str(room.id))
    )
    query = (User.query
             .join(UserSetting)
             .options(load_only('id'))
             .filter(UserSetting.module == 'roombooking',
                     email_mode_filter | room_blacklist_filter))
    disabled_emails = {u.email for u in query}
    emails |= room.METHOD_NAME() - disabled_emails
    return emails