<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def retry_with_delay(f, delay=60):
 """ Retry the wrapped requests.request function in case of ConnectionError. Optionally limit the number of retries or set the delay between retries. """

    @wraps(f)
    def inner(*args, **kwargs):
        kwargs['timeout'] = 5
        remaining = get_retries() + 1
        while remaining:
            remaining -= 1
            try:
                return f(*args, **kwargs)
            except (requests.ConnectionError, requests.Timeout):
                if not remaining:
                    raise
                gevent.sleep(delay)
    return inner