code: def encrypt(self, plaintext, nonce, encoder=encoding.RawEncoder):
          
          if len(nonce) != self.NONCE_SIZE:
              raise ValueError("The nonce must be exactly %s bytes long" %
                               self.NONCE_SIZE)
  
          ciphertext = libnacl.crypto_box_afternm(
              plaintext,
              nonce,
              self._shared_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` 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.
  
          :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`]