import base64
import hmac
import hashlib


def sign_v2(key, msg):
    """
    AWS version 2 signing by sha1 hashing and base64 encode.
    """
    return base64.b64encode(hmac.new(key, msg.encode("utf-8"), hashlib.sha1).digest())