code: async def insert(self, task: Task) -> None:
          '''Insert the given task class into the Tasky event loop.'''
  
          if not isinstance(task, Task):
              task = task()
  
          if task.name not in self.all_tasks:
              task.tasky = self
              self.all_tasks[task.name] = task
  
              await task.init()
  
          elif task != self.all_tasks[task.name]:
              raise Exception('Duplicate task %s' % task.name)
  
          if task.enabled:
              task.task = asyncio.ensure_future(self.start_task(task))
              self.running_tasks.add(task)
          else:
              task.task = None
  
          return tasync def insert(self, task: Task) -> None:
          '''Insert the given task class into the Tasky event loop.'''
  
          if not isinstance(task, Task):
              task = task()
  
          if task.name not in self.all_tasks:
              task.tasky = self
              self.all_tasks[task.name] = task
  
              await task.init()
  
          elif task != self.all_tasks[task.name]:
              raise Exception('Duplicate task %s' % task.name)
  
          if task.enabled:
              task.task = asyncio.ensure_future(self.start_task(task))
              self.running_tasks.add(task)
          else:
              task.task = None
  
          return task
docs: Insert the given task class into the Tasky event loop.