docs: def encode(self, data, content_encoding="aes128gcm"):
          """Encrypt the data.
  
          :param data: A serialized block of byte data (String, JSON, bit array,
              etc.) Make sure that whatever you send, your client knows how
              to understand it.
          :type data: str
          :param content_encoding: The content_encoding type to use to encrypt
              the data. Defaults to RFC8188 "aes128gcm". The previous draft-01 is
              "aesgcm", however this format is now deprecated.
          :type content_encoding: enum("aesgcm", "aes128gcm")
  
          """
          # Salt is a random 16 byte array.
          if not data:
              return
          if not self.auth_key or not self.receiver_key:
              raise WebPushException("No keys specified in subscription info")
          salt = None
          if content_encoding not in self.valid_encodings:
              raise WebPushException("Invalid content encoding specified. "
                                     "Select from " +
                                     json.dumps(self.valid_encodings))
          if content_encoding == "aesgcm":
              salt = os.urandom(16)
          # The server key is an ephemeral ECDH key used only for this
          # transaction
          server_key = ec.generate_private_key(ec.SECP256R1, default_backend())
          crypto_key = server_key.public_key().public_bytes(
              encoding=serialization.Encoding.X962,
              format=serialization.PublicFormat.UncompressedPoint
          )
  
          if isinstance(data, six.string_types):
              data = bytes(data.encode('utf8'))
          if content_encoding == "aes128gcm":
              encrypted = http_ece.encrypt(
                  data,
                  salt=salt,
                  private_key=server_key,
                  dh=self.receiver_key,
                  auth_secret=self.auth_key,
                  version=content_encoding)
              reply = CaseInsensitiveDict({
                  'body': encrypted
              })
          else:
              crypto_key = base64.urlsafe_b64encode(crypto_key).strip(b'=')
              encrypted = http_ece.encrypt(
                  data,
                  salt=salt,
                  private_key=server_key,
                  keyid=crypto_key.decode(),
                  dh=self.receiver_key,
                  auth_secret=self.auth_key,
                  version=content_encoding)
              reply = CaseInsensitiveDict({
                  'crypto_key': crypto_key,
                  'body': encrypted,
              })
              if salt:
                  reply['salt'] = base64.urlsafe_b64encode(salt).strip(b'=')
          return reply