<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def log_coroutine(self, cor, *args, **kwargs):
 """Run a coroutine logging any exception raised. This routine will not block until the coroutine is finished nor will it return any result. It will just log if any exception is raised by the coroutine during operation. It is safe to call from both inside and outside the event loop. There is no guarantee on how soon the coroutine will be scheduled. Args: cor (coroutine):
 The coroutine that we wish to run in the background and wait until it finishes. """


        if self.stopping:
            raise LoopStoppingError("Could not launch coroutine because loop is shutting down: %s" % cor)

        self.start()

        cor = _instaniate_coroutine(cor, args, kwargs)

        def _run_and_log():
            task = self.loop.create_task(cor)
            task.add_done_callback(lambda x: _log_future_exception(x, self._logger))

        if self.inside_loop():
            _run_and_log()
        else:
            self.loop.call_soon_threadsafe(_run_and_log)