code: def delete_doc(self, doc_id, revision):
          '''Imitates sending DELETE request to CouchDB server'''
          d = defer.Deferred()
  
          self.increase_stat('delete_doc')
  
          try:
              doc = self._get_doc(doc_id)
              if doc['_rev'] != revision:
                  raise ConflictError("Document update conflict.")
              if doc.get('_deleted', None):
                  raise NotFoundError('%s deleted' % doc_id)
              doc['_deleted'] = True
              self._expire_cache(doc['_id'])
              for key in doc.keys():
                  if key in ['_rev', '_deleted', '_id']:
                      continue
                  del(doc[key])
              self.log('Marking document %r as deleted', doc_id)
              del self._attachments[doc['_id']]
              self._update_rev(doc)
              self._analize_changes(doc)
              d.callback(Response(ok=True, id=doc_id, rev=doc['_rev']))
          except (ConflictError, NotFoundError, ) as e:
              d.errback(e)
  
          return f delete_doc(self, doc_id, revision):
          '''Imitates sending DELETE request to CouchDB server'''
          d = defer.Deferred()
  
          self.increase_stat('delete_doc')
  
          try:
              doc = self._get_doc(doc_id)
              if doc['_rev'] != revision:
                  raise ConflictError("Document update conflict.")
              if doc.get('_deleted', None):
                  raise NotFoundError('%s deleted' % doc_id)
              doc['_deleted'] = True
              self._expire_cache(doc['_id'])
              for key in doc.keys():
                  if key in ['_rev', '_deleted', '_id']:
                      continue
                  del(doc[key])
              self.log('Marking document %r as deleted', doc_id)
              del self._attachments[doc['_id']]
              self._update_rev(doc)
              self._analize_changes(doc)
              d.callback(Response(ok=True, id=doc_id, rev=doc['_rev']))
          except (ConflictError, NotFoundError, ) as e:
              d.errback(e)
  
          return d
docs: Imitates sending DELETE request to CouchDB server