def rate_limit_sleeper(api, response):
    """
    Pauses the execution if rate limit is breached.
    :param api: Api instance.
    :param response: requests.Response object

    """
    while response.status_code == 429:
        headers = response.headers
        remaining_time = headers.get('X-RateLimit-Reset')
        sleep = int(remaining_time) - int(time.time())
        logger.warning('Rate limit reached! Waiting for [%s]s', sleep)
        time.sleep(sleep + 5)
        response = api.session.send(response.request)
    return response
Pauses the execution if rate limit is breached.
    :param api: Api instance.
    :param response: requests.Response object