def can_send(self):
        tdiff = time.time() - self.last_send_time
        if tdiff <= 0:
            return 0
        max_quantum = self.speed * TIME_QUANTUM
        max_send_size = max(0,
                            min(self.speed * tdiff - self.last_send_size,
                                max_quantum))
        return int(max_send_size)

    ##########################################################
Try to execute multiple times function mitigating exceptions.
dataset/ETHPy150Open dsiroky/snakemq/snakemq/throttle.py/ConnectionInfo.can_send--crossover with--dataset/ETHPy150Open openstack/rally/rally/common/utils.py/retry