code: def retry(self, f, *args, **kwargs):
          
          backoff = random.random() / 100  # 5ms on average
          for _ in range(self.tries - 1):
              try:
                  return f(*args, **kwargs)
              except NetworkError:
                  time.sleep(backoff)
                  backoff *= 2
          return f(*args, **kwargs)
docs: Retries the given function self.tries times on NetworkErros