title: retry decorator implementation, retries not defined
body: <p>I have implemented the following retry decorator.</p>
  
  <pre><code>def retry(delay=10, retries=4):
      def retry_decorator(f):
          @wraps(f)
          def f_retry(*args, **kwargs):
              while retries &gt; 1:
                  try:
                      return f(*args, **kwargs)
                  except Exception as e:
                      msg = "Exception: {}, Retrying in {} seconds...'.format(e, delay)"
                      print(msg)
                      time.sleep(delay)
                      retries -= 1
              return f(*args, **kwargs)
  
          return f_retry
  
      return retry_decorator
  </code></pre>
  
  <p>I get the error that retries is not defined. However, retries is mentioned in the function definition. I am unable to figure out what went wrong here. Any help will be appreciated.</p>