Calculate the signature for the given secret and other arguments.

        The headers must be the correct header value list in the proper order.

def fost_hmac_request_signature_with_headers(
    secret, method, path, timestamp, headers, body):
    """
        Calculate the signature for the given secret and other arguments.

        The headers must be the correct header value list in the proper order.
    """
    document = "%s %s\n%s\n%s\n%s" % (
        method, path,
        timestamp,
        '\n'.join(headers),
        body)
    signature = sha1_hmac(secret, document)
    logging.info("Calculated signature %s for document\n%s", signature, document)
    return document, signature