def _verify(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding=False):
if not isinstance(certificate_or_public_key, (Certificate, PublicKey)):<EOL><INDENT>raise TypeError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>type_name(certificate_or_public_key)<EOL>))<EOL><DEDENT>if not isinstance(signature, byte_cls):<EOL><INDENT>raise TypeError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>type_name(signature)<EOL>))<EOL><DEDENT>if not isinstance(data, byte_cls):<EOL><INDENT>raise TypeError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>type_name(data)<EOL>))<EOL><DEDENT>valid_hash_algorithms = set(['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'])<EOL>if certificate_or_public_key.algorithm == '<STR_LIT>' and not rsa_pss_padding:<EOL><INDENT>valid_hash_algorithms |= set(['<STR_LIT>'])<EOL><DEDENT>if hash_algorithm not in valid_hash_algorithms:<EOL><INDENT>valid_hash_algorithms_error = '<STR_LIT>'<EOL>if certificate_or_public_key.algorithm == '<STR_LIT>' and not rsa_pss_padding:<EOL><INDENT>valid_hash_algorithms_error += '<STR_LIT>'<EOL><DEDENT>raise ValueError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>valid_hash_algorithms_error,<EOL>repr(hash_algorithm)<EOL>))<EOL><DEDENT>if certificate_or_public_key.algorithm != '<STR_LIT>' and rsa_pss_padding is not False:<EOL><INDENT>raise ValueError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>certificate_or_public_key.algorithm.upper()<EOL>))<EOL><DEDENT>if hash_algorithm == '<STR_LIT>':<EOL><INDENT>if len(data) > certificate_or_public_key.byte_size - <NUM_LIT:11>:<EOL><INDENT>raise ValueError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>certificate_or_public_key.byte_size,<EOL>len(data)<EOL>))<EOL><DEDENT><DEDENT>if _backend == '<STR_LIT>':<EOL><INDENT>if certificate_or_public_key.algorithm == '<STR_LIT>':<EOL><INDENT>return _pure_python_ecdsa_verify(certificate_or_public_key, signature, data, hash_algorithm)<EOL><DEDENT>return _advapi32_verify(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding)<EOL><DEDENT>return _bcrypt_verify(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding)<EOL>
Verifies an RSA, DSA or ECDSA signature

:param certificate_or_public_key:
    A Certificate or PublicKey instance to verify the signature with

:param signature:
    A byte string of the signature to verify

:param data:
    A byte string of the data the signature is for

:param hash_algorithm:
    A unicode string of "md5", "sha1", "sha256", "sha384", "sha512" or "raw"

:param rsa_pss_padding:
    If PSS padding should be used for RSA keys

:raises:
    oscrypto.errors.SignatureError - when the signature is determined to be invalid
    ValueError - when any of the parameters contain an invalid value
    TypeError - when any of the parameters are of the wrong type
    OSError - when an error is returned by the OS crypto library