def for_attempt(self, attempt):
        """
        :meth:`for_attempt` returns the duration for a specific attempt.
        This is useful if you have a large number of independent backoffs,
        but don't want to use unnecessary memory storing the backoff parameters
        per backoff. The first attempt should be 0.
        :meth:`for_attempt` is thread-safe if non-zero values for
        :attr:`factor`, :attr:`max_ms`, and :attr:`min_ms` are set before
        any calls to :meth:`for_attempt` are made.

        :param attempt: the attempt you want to return duration for
        :type attempt: float
        :return: duration in seconds
        :rtype: float
        """
        dur = float(self.min_ms * pow(self.factor, attempt))

        if self.jitter:
            dur = random.random() * (dur - self.min_ms) + self.min_ms

        if dur > self.max_ms:
            return to_seconds(self.max_ms)

        return to_seconds(dur)