def verify_signature(public_key, signature, hash, hash_algo):
hash_algo = _hash_algorithms[hash_algo]<EOL>try:<EOL><INDENT>return get_publickey(public_key).verify(<EOL>signature,<EOL>hash,<EOL>padding.PKCS1v15(),<EOL>utils.Prehashed(hash_algo),<EOL>) is None<EOL><DEDENT>except InvalidSignature:<EOL><INDENT>return False<EOL><DEDENT>
Verify the given signature is correct for the given hash and public key.

    Args:
        public_key (str): PEM encoded public key
        signature (bytes): signature to verify
        hash (bytes): hash of data
        hash_algo (str): hash algorithm used

    Returns:
        True if the signature is valid, False otherwise