'Return how many seconds are left until the timeout expires'

def time_left(self):

    if self.is_non_blocking:
        return 0
    elif self.is_infinite:
        return None
    else:
        delta = (self.target_time - self.TIME())
        if (delta > self.duration):
            self.target_time = (self.TIME() + self.duration)
            return self.duration
        else:
            return max(0, delta)
