import hmac
import hashlib


def calculate_signature(secret, timestamp, payload):
    """Calculates hmac signature with the given secret"""
    signature_message = "{}.{}".format(timestamp, payload).encode("utf-8")
    return hmac.new(
        secret.encode("utf-8"), signature_message, hashlib.sha512
    ).hexdigest()