code: def add_task(self, task):
          
          try:
              if callable(task):
                  try:
                      self.loop.create_task(task(self))
                  except TypeError:
                      self.loop.create_task(task())
              else:
                  self.loop.create_task(task)
          except SanicException:
  
              @self.listener("before_server_start")
              def run(app, loop):
                  if callable(task):
                      try:
                          loop.create_task(task(self))
                      except TypeError:
                          loop.create_task(task())
                  else:
                      loop.create_task(task)
docs: Schedule a task to run later, after the loop has started.
          Different from asyncio.ensure_future in that it does not
          also return a future, and the actual ensure_future call
          is delayed until before server start.
  
          :param task: future, couroutine or awaitable