Verify that a given serialized key, when imported, has the given key ID.
    Return True on success
    Return False on error

def gpg_verify_key( key_id, key_data, config_dir=None ):
    """
    Verify that a given serialized key, when imported, has the given key ID.
    Return True on success
    Return False on error
    """

    key_data = str(key_data)

    config_dir = get_config_dir( config_dir )
    sanitized_key_id = "".join( key_id.upper().split(" ") )
    
    if len(sanitized_key_id) < 16:
        log.debug("Fingerprint is too short to be secure")
        return False

    fingerprint = gpg_key_fingerprint( key_data, config_dir=config_dir )
    if fingerprint is None:
        log.debug("Failed to fingerprint key")
        return False

    if sanitized_key_id != fingerprint and not fingerprint.endswith( sanitized_key_id ):
        log.debug("Imported key does not match the given ID")
        return False

    else:
        return True