code: def save(self):
          
          if self.views:
              if self.get('language', None) != QUERY_LANGUAGE:
                  for view_name, view in self.iterviews():
                      if isinstance(view, QueryIndexView):
                          raise CloudantDesignDocumentException(104, view_name)
              else:
                  for view_name, view in self.iterviews():
                      if not isinstance(view, QueryIndexView):
                          raise CloudantDesignDocumentException(105, view_name)
  
          if self.indexes:
              if self.get('language', None) != QUERY_LANGUAGE:
                  for index_name, search in self.iterindexes():
                      # Check the instance of the javascript search function
                      if not isinstance(search['index'], STRTYPE):
                          raise CloudantDesignDocumentException(106, index_name)
              else:
                  for index_name, index in self.iterindexes():
                      if not isinstance(index['index'], dict):
                          raise CloudantDesignDocumentException(107, index_name)
  
          for prop in self._nested_object_names:
              if not getattr(self, prop):
                  # Ensure empty dict for each sub-object is not saved remotely.
                  self.__delitem__(prop)
  
          super(DesignDocument, self).save()
  
          for prop in self._nested_object_names:
              # Ensure views, indexes, and lists dict exist in locally cached DesignDocument.
              getattr(self, prop, self.setdefault(prop, dict()))
docs: Saves changes made to the locally cached DesignDocument object's data
          structures to the remote database.  If the design document does not
          exist remotely then it is created in the remote database.  If the object
          does exist remotely then the design document is updated remotely.  In
          either case the locally cached DesignDocument object is also updated
          accordingly based on the successful response of the operation.