def before_loop(self, coro):
        """A function that also acts as a decorator to register a coroutine to be
        called before the loop starts running. This is useful if you want to wait
        for some bot state before the loop starts,
        such as :meth:`discord.Client.wait_until_ready`.

        Parameters
        ------------
        coro: :term:`py:awaitable`
            The coroutine to register before the loop runs.

        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._before_loop = coro