<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def http_retry_with_backoff_middleware( make_request, web3, # pylint: disable=unused-argument errors: Tuple = ( exceptions.ConnectionError, exceptions.HTTPError, exceptions.Timeout, exceptions.TooManyRedirects, ), retries: int = 10, first_backoff: float = 0.2, backoff_factor: float = 2, ):
 """ Retry requests with exponential backoff Creates middleware that retries failed HTTP requests and exponentially increases the backoff between retries. Meant to replace the default middleware `http_retry_request_middleware` for HTTPProvider. """

    def middleware(method, params):
        backoff = first_backoff
        if check_if_retry_on_failure(method):
            for i in range(retries):
                try:
                    return make_request(method, params)
                except errors:
                    if i < retries - 1:
                        gevent.sleep(backoff)
                        backoff *= backoff_factor
                        continue
                    else:
                        raise
        else:
            return make_request(method, params)

    return middleware