code: def delete(self, task_id):
      
      if isinstance(task_id, RegisteredTask):
        task_id = task_id.id
  
      def cloud_delete(api):
        api.delete(task_id)
  
      if len(self._threads):
        self.put(cloud_delete)
      else:
        cloud_delete(self._api)
  
      return self
docs: Deletes a task from a TaskQueue.