Write retry(times) - a decorator factory that retries a function when it raises.
@retry(3) means the wrapped function is attempted up to three times in total. The first result that does not raise is returned. If every attempt raises, the last exception is allowed through.
The wrapper must pass along whatever arguments it was given, so it works on any function.