code: def delete(self, user):
          
          if user:
              can_delete = yield self.can_delete(user)
          else:
              can_delete = False
  
          if not can_delete:
              raise exceptions.Unauthorized('User may not delete the resource')
  
          doc = {
              '_id': self.id,
              '_deleted': True
          }
  
          try:
              doc['_rev'] = self._rev
          except AttributeError:
              pass
  
          db = self.db_client()
          yield db.save_doc(doc)
  
          self._resource = doc
docs: Delete a resource