policy = input.read()
policy_encoded = base64.b64encode(policy)
signature = base64.b64encode(hmac.new(private_key, policy_encoded, sha).
    digest())
print('Your policy base-64 encoded is %s.' % policy_encoded)
print('Your signature base-64 encoded is %s.' % signature)
print('Your signature encoded should be 2qCp0odXe7A9IYyUVqn0w2adtCA=')
Python Generated Signature for S3 Post