code: def encrypt_fields(self, document, fieldspec, prefix):
          
          json_encoded = json.dumps(document)
          encrypted_string = _Base.encrypt_fields(self, json_encoded, fieldspec, prefix)
          if not encrypted_string:
              raise couchbase.exceptions.CouchbaseError("Encryption failed")
          return json.loads(encrypted_string)
docs: Encrypt a document using the registered encryption providers.
          :param document: The document body.
          :param fieldspec: A list of field specifications, each of which is
          a dictionary as follows:
              {
                  'alg' : registered algorithm name,
                  'kid' : key id to use to encrypt with,
                  'name' : field name
              }
          :param prefix: Prefix for encrypted field names. Default is None.
          :return: Encrypted document.