def calculate_backoff(self, retries: int, ex: BaseException) -> float:
        """Returns the time to sleep before the next try."""
        if retries <= 0:
            return 0
        backoff: float = self.config.backoff_factor * (2 ** (retries - 1))
        return max(0.0, min(backoff, self.config.backoff_max))
Returns the time to sleep before the next try.
lightly/api/retry_utils.py