def putSecret(name, secret, version, kms_key='alias/credstash', region='us-east-1', table='credential-store', context=None):
    '\n    put a secret called `name` into the secret-store,\n    protected by the key kms_key\n    '
    if (not context):
        context = {}
    kms = boto3.client('kms', region_name=region)
    try:
        kms_response = kms.generate_data_key(KeyId=kms_key, EncryptionContext=context, NumberOfBytes=64)
    except:
        raise KmsError(('Could not generate key using KMS key %s' % kms_key))
    data_key = kms_response['Plaintext'][:32]
    hmac_key = kms_response['Plaintext'][32:]
    wrapped_key = kms_response['CiphertextBlob']
    enc_ctr = Counter.new(128)
    encryptor = AES.new(data_key, AES.MODE_CTR, counter=enc_ctr)
    c_text = encryptor.encrypt(secret)
    hmac = HMAC(hmac_key, msg=c_text, digestmod=SHA256)
    b64hmac = hmac.hexdigest()
    dynamodb = boto3.resource('dynamodb', region_name=region)
    secrets = dynamodb.Table(table)
    data = {}
    data['name'] = name
    data['version'] = (version if (version != '') else paddedInt(1))
    data['key'] = b64encode(wrapped_key).decode('utf-8')
    data['contents'] = b64encode(c_text).decode('utf-8')
    data['hmac'] = b64hmac
    return secrets.put_item(Item=data, ConditionExpression=Attr('name').not_exists())
put a secret called `name` into the secret-store,
protected by the key kms_key
def putSecret(name, secret, version, kms_key='alias/credstash', region='us-east-1', table='credential-store', context=None):
    '\n    put a secret called `name` into the secret-store,\n    protected by the key kms_key\n    '
    if (not context):
        context = {}
    kms = boto3.client('kms', region_name=region)
    try:
        kms_response = kms.generate_data_key(KeyId=kms_key, EncryptionContext=context, NumberOfBytes=64)
    except:
        raise KmsError(('Could not generate key using KMS key %s' % kms_key))
    data_key = kms_response['Plaintext'][:32]
    hmac_key = kms_response['Plaintext'][32:]
    wrapped_key = kms_response['CiphertextBlob']
    enc_ctr = Counter.new(128)
    encryptor = AES.new(data_key, AES.MODE_CTR, counter=enc_ctr)
    c_text = encryptor.encrypt(secret)
    hmac = HMAC(hmac_key, msg=c_text, digestmod=SHA256)
    b64hmac = hmac.hexdigest()
    dynamodb = boto3.resource('dynamodb', region_name=region)
    secrets = dynamodb.Table(table)
    data = {}
    data['name'] = name
    data['version'] = (version if (version != ) else paddedInt(1))
    data['key'] = b64encode(wrapped_key).decode('utf-8')
    data['contents'] = b64encode(c_text).decode('utf-8')
    data['hmac'] = b64hmac
    return secrets.put_item(Item=data, ConditionExpression=Attr('name').not_exists())