def clean(self, value):
        super(CommaSeparatedUserField, self).clean(value)

        names = set(value.split(','))
        names_set = set([name.strip() for name in names])
        users = list(get_user_model().objects.filter(username__in=names_set))

        # Check for unknown names.
        unknown_names = names_set ^ set([user.username for user in users])

        recipient_filter = self._recipient_filter
        invalid_users = []
        if recipient_filter is not None:
            for r in users:
                if recipient_filter(r) is False:
                    users.remove(r)
                    invalid_users.append(r.username)

        if unknown_names or invalid_users:
            humanized_usernames = ', '.join(list(unknown_names) + invalid_users)
            raise forms.ValidationError(_("The following usernames are incorrect: %(users)s.") % {'users': humanized_usernames})

        return users
dataset/ETHPy150Open bread-and-pepper/django-userena/userena/contrib/umessages/fields.py/CommaSeparatedUserField.clean/original