def after_loop(self, coro):
        """A function that also acts as a decorator to register a coroutine to be
        called after the loop finished running.

        Parameters
        ------------
        coro: :term:`py:awaitable`
            The coroutine to register after the loop finishes.

        Raises
        -------
        TypeError
            The function was not a coroutine.
        """

        if not (inspect.iscoroutinefunction(coro) or inspect.isawaitable(coro)):
            raise TypeError('Expected coroutine or awaitable, received {0.__name__!r}.'.format(type(coro)))

        self._after_loop = coro