def encrypt(key, message):
try:<EOL><INDENT>ret = kms.encrypt(KeyId=key, Plaintext=message)<EOL>encrypted_data = base64.encodestring(ret.get('<STR_LIT>'))<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise Exception("<STR_LIT>", e)<EOL><DEDENT>return encrypted_data.decode()<EOL>
encrypt leverages KMS encrypt and base64-encode encrypted blob

        More info on KMS encrypt API:
        https://docs.aws.amazon.com/kms/latest/APIReference/API_encrypt.html