def terminate(self, *, force: bool=False, timeout: float=<NUM_LIT>,<EOL>step: float=<NUM_LIT:1.0>) -> None:
if isinstance(self.monitor, asyncio.Future):<EOL><INDENT>Log.debug('<STR_LIT>')<EOL>self.monitor.cancel()<EOL><DEDENT>Log.debug('<STR_LIT>')<EOL>for task in list(self.running_tasks):<EOL><INDENT>if task.task.done():<EOL><INDENT>Log.debug('<STR_LIT>', task.name)<EOL>self.running_tasks.discard(task)<EOL><DEDENT>else:<EOL><INDENT>Log.debug('<STR_LIT>', task.name)<EOL>asyncio.ensure_future(task.stop(force=force))<EOL><DEDENT><DEDENT>if timeout > <NUM_LIT:0> and (self.monitor or self.running_tasks):<EOL><INDENT>Log.debug('<STR_LIT>',<EOL>timeout, len(self.running_tasks))<EOL>timeout -= step<EOL>fn = functools.partial(self.terminate, force=force,<EOL>timeout=timeout, step=step)<EOL>return self.loop.call_later(step, fn)<EOL><DEDENT>if timeout > <NUM_LIT:0>:<EOL><INDENT>Log.debug('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>Log.debug('<STR_LIT>')<EOL><DEDENT>self.loop.stop()<EOL>
Stop all scheduled and/or executing tasks, first by asking nicely,
        and then by waiting up to `timeout` seconds before forcefully stopping
        the asyncio event loop.