'Verifies the signature for a given message.'

def Verify(self, message, signature):

    siglen = len(signature)
    if (siglen == 20):
        hash_algorithm = hashes.SHA1()
    elif (siglen == 32):
        hash_algorithm = hashes.SHA256()
    else:
        raise VerificationError(('Invalid    signature    length    %d.' % siglen))
    h = hmac.HMAC(self.key, hash_algorithm, backend=openssl.backend)
    h.update(message)
    try:
        h.verify(signature)
        return True
    except exceptions.InvalidSignature as e:
        raise VerificationError(e)
