def check_stable(self, at_time): from tally import Tally end = datetime.utcnow() if at_time is None else at_time start = end - self.scope.instance.activation_timedelta tallies = Tally.all_samples(self, start, end) if not len(tallies): return False if tallies[0].create_time > start: return False for tally in tallies: if not (tally.has_participation() and tally.has_majority()): return False return True