def post_message_to_users(self, msg_text, sender=None,
                               msg_type='announcement', **kwargs):
        max_length = DatedMessage._meta.get_field("msg_text").max_length
        m = self.create(
            msg_text=msg_text[:max_length], type=msg_type, sender=sender,
        )
        for user in User.objects.filter(**kwargs):
            m.users.add(user)
send a message to users matching the filter arguments in kwargs.
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/messaging/models.py/DatedMessageManager.post_message_to_users