'Set the verification status of the participant\'s national identity for a given country.
:param int country_id: an ``id`` from the ``countries`` table
:param bool is_verified: whether the information has been verified or not
This is a no-op if the participant has no identity on file for the
given ``country_id``.'

def set_identity_verification(self, country_id, is_verified):

    is_verified = bool(is_verified)
    action = (u'verify' if is_verified else u'unverify')
    with self.db.get_cursor() as cursor:
        old = cursor.one(u'\n\n                                                                SELECT    id,    is_verified\n                                                                        FROM    participant_identities\n                                                                    WHERE    participant_id=%(participant_id)s\n                                                                            AND    country_id=%(country_id)s\n\n                                                ', dict(locals(), participant_id=self.id))
        cursor.run(u'\n\n                                                                UPDATE    participant_identities\n                                                                            SET    is_verified=%(is_verified)s\n                                                                    WHERE    participant_id=%(participant_id)s\n                                                                            AND    country_id=%(country_id)s\n\n                                                ', dict(locals(), participant_id=self.id))
        payload = dict(id=self.id, identity_id=(old.id if old else None), country_id=country_id, new_value=is_verified, old_value=(old.is_verified if old else None), action=(action + u'    identity'))
        self.app.add_event(cursor, u'participant', payload)
        self._update_has_verified_identity(cursor)
