<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def _wait_exponentially(self, exception, max_wait_time=300):
 """Wait exponentially longer for each connection attempt. Calculate the number of seconds to wait and then add a random number of milliseconds to avoid coincendental synchronized client retries. Wait up to the maximium amount of wait time specified via 'max_wait_time'. However, if Slack returned how long to wait use that. """

        wait_time = min(
            (2 ** self._connection_attempts) + random.random(), max_wait_time
        )
        try:
            wait_time = exception.response["headers"]["Retry-After"]
        except (KeyError, AttributeError):
            pass
        self._logger.debug("Waiting %s seconds before reconnecting.", wait_time)
        await asyncio.sleep(float(wait_time))