class_docstr: Create a retryable version of a function.
  
  Calling this will call the passed function, retrying if any exceptions in
  retryable_exceptions are caught, with exponential backoff.
class_docstr_tok: ["Create","a","retryable","version","of","a","function",".","Calling","this","will","call","the","passed","function",",","retrying","if","any","exceptions","in","retryable_exceptions","are","caught",",","with","exponential","backoff","."]
code: def __init__(
      self,
      call_fn: Callable[..., _R],
      retry_timedelta: Optional[datetime.timedelta] = None,
      retry_cancel_event: Optional[threading.Event] = None,
      num_retries: Optional[int] = None,
      check_retry_fn: CheckRetryFnType = lambda e: True,
      retryable_exceptions: Optional[
          Tuple[Type[Exception], ...]
      ] = None,
      error_prefix: str = "Network error",
      retry_callback: Optional[Callable[[int, str], Any]] = None,
  ) -> None:
      self._call_fn = call_fn
      self._check_retry_fn = check_retry_fn
      self._error_prefix = error_prefix
      self._last_print = datetime.datetime.now() - datetime.timedelta(
          minutes=1
      )
      self._retry_timedelta = retry_timedelta
      self._retry_cancel_event = retry_cancel_event
      self._num_retries = num_retries
      if retryable_exceptions is not None:
          self._retryable_exceptions = retryable_exceptions
      else:
          self._retryable_exceptions = (TransientError,)
      self._index = 0
      self.retry_callback = retry_callback
  
imports: import abc
  import asyncio
  import datetime
  import functools
  import logging
  import os
  import random
  import threading
  import time
  from typing import Any, Awaitable, Callable, Generic, Optional, Tuple, Type, TypeVar
  from requests import HTTPError
  import wandb
  from wandb.util import CheckRetryFnType
  from .mailbox import ContextCancelledError
label_desc: Use image node_id 1 to create a new Retry object from inherited base classes: Generic with example: obj = Retry(call_fn, retry_timedelta, retry_cancel_event, num_retries, check_retry_fn, retryable_exceptions, error_prefix, retry_callback)