import time

def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
    """Retry calling the decorated function using an exponential backoff.

    http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/
    original from: http://wiki.python.org/moin/PythonDecoratorLibrary#Retry

    :param ExceptionToCheck: the exception to check. may be a tuple of
        excpetions to check
    :type ExceptionToCheck: Exception or tuple
    :param tries: number of times to try (not retry) before giving up
    :type tries: int
    :param delay: initial delay between retries in seconds
    :type delay: int
    :param backoff: backoff multiplier e.g. value of 2 will double the delay
        each retry
    :type backoff: int
    :param logger: logger to use. If None, print
    :type logger: logging.Logger instance
    """
    def deco_retry(f):
        def f_retry(*args, **kwargs):
            mtries, mdelay = tries, delay
            try_one_last_time = True
            while mtries > 1:
                try:
                    return f(*args, **kwargs)
                    try_one_last_time = False
                    break
                except ExceptionToCheck, e:
                    msg = "%s, Retrying in %d seconds..." % (str(e), mdelay)
                    if logger:
                        logger.warning(msg)
                    else:
                        print msg
                    time.sleep(mdelay)
                    mtries -= 1
                    mdelay *= backoff
            if try_one_last_time:
                return f(*args, **kwargs)
            return
        return f_retry  # true decorator
    return deco_retry

@@ -5,16 +5,45 @@
 rt time%0A
+from functools import wraps%0A%0A
 %0Adef ret
@@ -418,18 +418,18 @@
      exc
-p
 e
+p
 tions to
@@ -893,16 +893,35 @@
 etry(f):
+%0A%0A        @wraps(f)
 %0A       
@@ -997,45 +997,8 @@
 lay%0A
-            try_one_last_time = True%0A
     
@@ -1094,80 +1094,8 @@
 gs)%0A
-                    try_one_last_time = False%0A                    break%0A
     
@@ -1459,46 +1459,8 @@
 off%0A
-            if try_one_last_time:%0A    
     
@@ -1493,34 +1493,16 @@
 kwargs)%0A
-            return
 %0A       
@@ -1535,16 +1535,17 @@
 corator%0A
+%0A
     retu

Remove unreachable code. Use functools.wraps.