def METHOD_NAME(self, field):
    query = Identity.query.filter(Identity.provider == 'indico',
                                  Identity.identifier == field.data,
                                  Identity.identifier != self.identity.identifier)
    if query.has_rows():
        raise ValidationError(_('This username is already in use.'))