code: async def cancel_task(app: web.Application,
                        task: asyncio.Task,
                        *args, **kwargs
                        ) -> Any:
      
      return await get_scheduler(app).cancel(task, *args, **kwargs)
docs: Convenience function for calling `TaskScheduler.cancel(task)`
  
      This will use the default `TaskScheduler` to cancel the given task.
  
      Example:
  
          import asyncio
          from datetime import datetime
          from brewblox_service import scheduler, service
  
          async def current_time(interval):
              while True:
                  await asyncio.sleep(interval)
                  print(datetime.now())
  
  
          async def stop_after(app, task, duration):
              await asyncio.sleep(duration)
              await scheduler.cancel_task(app, task)
              print('stopped!')
  
  
          async def start(app):
              # Start first task
              task = await scheduler.create_task(app, current_time(interval=2))
  
              # Start second task to stop the first
              await scheduler.create_task(app, stop_after(app, task, duration=10))
  
  
          app = service.create_app(default_name='example')
  
          scheduler.setup(app)
          app.on_startup.append(start)
  
          service.furnish(app)
          service.run(app)