def delete(self, all_versions=True):
        """Deletes an object from the database."""
        # TODO(tomchop): Revisit inheritance model of ArangoDBConnector.
        if hasattr(self, "clear_tags"):
            self.clear_tags()
        col = self._db.collection(self._collection_name)
        self._delete_vertex_refs_in_graphs(self.extended_id)
        job = col.delete(self.id)
        while job.status() != "done":
            time.sleep(ASYNC_JOB_WAIT_TIME)
        if self._collection_name in ("auditlog", "timeline"):
            return
        try:
            event_type = message.EventType.delete
            if self._collection_name == "links":
                source_collection, source_id = self.source.split("/")
                target_collection, target_id = self.target.split("/")
                job = self._db.collection(source_collection).get(source_id)
                while job.status() != "done":
                    time.sleep(ASYNC_JOB_WAIT_TIME)
                source_obj = job.result()
                job = self._db.collection(target_collection).get(target_id)
                while job.status() != "done":
                    time.sleep(ASYNC_JOB_WAIT_TIME)
                target_obj = job.result()
                event = message.LinkEvent(
                    type=event_type,
                    source_object=source_obj,
                    target_object=target_obj,
                    relationship=self,
                )
            else:
                event = message.ObjectEvent(type=event_type, yeti_object=self)
            producer.publish_event(event)
        except Exception:
            logging.exception("Error while publishing event")
Deletes an object from the database.
core/database_arango.py