'Vault encrypt a piece of data.
:arg plaintext: a text or byte string to encrypt.
:returns: a utf-8 encoded byte str of encrypted data.  The string
contains a header identifying this as vault encrypted data and
formatted to newline terminated lines of 80 characters.  This is
suitable for dumping as is to a vault file.
If the string passed in is a text string, it will be encoded to UTF-8
before encryption.'

def encrypt(self, plaintext, secret=None, vault_id=None):

    if (secret is None):
        if self.secrets:
            (dummy, secret) = match_encrypt_secret(self.secrets)
        else:
            raise AnsibleVaultError('A    vault    password    must    be    specified    to    encrypt    data')
    b_plaintext = to_bytes(plaintext, errors='surrogate_or_strict')
    if is_encrypted(b_plaintext):
        raise AnsibleError('input    is    already    encrypted')
    if ((not self.cipher_name) or (self.cipher_name not in CIPHER_WRITE_WHITELIST)):
        self.cipher_name = u'AES256'
    try:
        this_cipher = CIPHER_MAPPING[self.cipher_name]()
    except KeyError:
        raise AnsibleError(u'{0}    cipher    could    not    be    found'.format(self.cipher_name))
    display.vvvvv(('Encrypting    with    vault    secret    %s' % secret))
    b_ciphertext = this_cipher.encrypt(b_plaintext, secret)
    b_vaulttext = format_vaulttext_envelope(b_ciphertext, self.cipher_name, vault_id=vault_id)
    return b_vaulttext
