def key_exists(self, key, secret=False):
        '''
        Check is given key exists.

        :param key: Key ID
        :param secret: Check secret key
        :rtype: bool
        '''
        if len(key) < 8:
            return False
        key = key.upper()
        res = self.list_keys(secret)
        for fingerprint in res.keys:
            if fingerprint.endswith(key):
                return True
        return False
def key_exists ( self , key , secret = False ) : if len ( key ) < 8 : return False key = key . upper ( ) res = self . list_keys ( secret ) for fingerprint in res . keys : if fingerprint . endswith ( key ) : return True return False
Check is given key exists.

        :param key: Key ID
        :param secret: Check secret key
        :rtype: bool