def check_uid_validity(key, email):
    """Check that a the email belongs to the given key.  Also check the trust
    level of this connection.  Only if the trust level is high enough (>=4) the
    email is assumed to belong to the key.

    :param key: the GPG key to which the email should belong
    :type key: gpg.gpgme._gpgme_key
    :param email: the email address that should belong to the key
    :type email: str
    :returns: whether the key can be assumed to belong to the given email
    :rtype: bool
    """
    def check(key_uid):
        return (email == key_uid.email and
                not key_uid.revoked and
                not key_uid.invalid and
                key_uid.validity >= gpg.constants.validity.FULL)

    return any(check(u) for u in key.uids)
def check_uid_validity ( key , email ) : def check ( key_uid ) : return ( email == key_uid . email and not key_uid . revoked and not key_uid . invalid and key_uid . validity >= gpg . constants . validity . FULL ) return any ( check ( u ) for u in key . uids )
Check that a the email belongs to the given key.  Also check the trust
    level of this connection.  Only if the trust level is high enough (>=4) the
    email is assumed to belong to the key.

    :param key: the GPG key to which the email should belong
    :type key: gpg.gpgme._gpgme_key
    :param email: the email address that should belong to the key
    :type email: str
    :returns: whether the key can be assumed to belong to the given email
    :rtype: bool