code: def encrypt(self, plaintext, nonce=None, encoder=encoding.RawEncoder):
          
          if nonce is None:
              nonce = random(self.NONCE_SIZE)
  
          if len(nonce) != self.NONCE_SIZE:
              raise exc.ValueError(
                  "The nonce must be exactly %s bytes long" % self.NONCE_SIZE,
              )
  
          ciphertext = nacl.bindings.crypto_secretbox(plaintext,
                                                      nonce, self._key)
  
          encoded_nonce = encoder.encode(nonce)
          encoded_ciphertext = encoder.encode(ciphertext)
  
          return EncryptedMessage._from_parts(
              encoded_nonce,
              encoded_ciphertext,
              encoder.encode(nonce + ciphertext),
          )
docs: Encrypts the plaintext message using the given `nonce` (or generates
          one randomly if omitted) and returns the ciphertext encoded with the
          encoder.
  
          .. warning:: It is **VITALLY** important that the nonce is a nonce,
              i.e. it is a number used only once for any given key. If you fail
              to do this, you compromise the privacy of the messages encrypted.
              Give your nonces a different prefix, or have one side use an odd
              counter and one an even counter. Just make sure they are different.
  
          :param plaintext: [:class:`bytes`] The plaintext message to encrypt
          :param nonce: [:class:`bytes`] The nonce to use in the encryption
          :param encoder: The encoder to use to encode the ciphertext
          :rtype: [:class:`nacl.utils.EncryptedMessage`]