import hmac


def calculate_message_signature(key: str, msg: str):
    """
    calculate a message signature using a SHA1 HMAC
    :param key: the secret token
    :param msg: the message
    :return: the calculated HMAC
    """
    return hmac.new(key.encode(), msg=msg.encode(), digestmod='sha1').hexdigest()