def signature(cert, sig, body):
    """Validate data request signature.

    See `validate.request` for additional info.

    Args:
        cert: cryptography.hazmat.backends.openssl.x509._Certificate. The Amazon
            signing certificate.
        sig: str. Signature header value sent by request.
        body: str. HTTPS request body.

    Returns:
        bool: True if valid, False otherwise.
    """
    body = six.b(body)

    sig = base64.decodestring(sig)
    padder = padding.PKCS1v15()
    public_key = cert.public_key()
    try:
        public_key.verify(sig, body, padder, hashes.SHA1())
        return True
    except InvalidSignature:
        warnings.warn('Signature verification failed.')
        return False
Validate data request signature.

    See `validate.request` for additional info.

    Args:
        cert: cryptography.hazmat.backends.openssl.x509._Certificate. The Amazon
            signing certificate.
        sig: str. Signature header value sent by request.
        body: str. HTTPS request body.

    Returns:
        bool: True if valid, False otherwise.