def make_request_callback(self, timeout_count, body_on_success, http_error_status=504):
        attempts = [0]  # use a list for nonlocal mutability used in request_callback

        def request_callback(request):
            attempts[0] += 1

            if attempts[0] <= timeout_count:
                return (http_error_status, {}, "Timeout")
            else:
                resp_body = dict(body_on_success)
                return (200, {}, json.dumps(resp_body))

        return (request_callback, attempts)
Substitute occurences of ${foo} with conf[foo], recursively, in all the values
dataset/ETHPy150Open scrapinghub/python-hubstorage/tests/test_retry.py/RetryTest.make_request_callback--crossover with--dataset/ETHPy150Open cloudera/hue/apps/jobbrowser/src/jobbrowser/views.py/make_substitutions