'Calculate a v1 signature.
:param bytes string_to_sign: String that contains request params and
is used for calculate signature of request
:param text secret_key: Second auth key of EC2 account that is used to
sign requests'

def _calculate_signature_v1(self, string_to_sign, secret_key):

    key = str(secret_key).encode('utf-8')
    if six.PY2:
        b64_encode = base64.encodestring
    else:
        b64_encode = base64.encodebytes
    signed = b64_encode(hmac.new(key, string_to_sign, hashlib.sha1).digest()).decode('utf-8').strip()
    return signed
