code: def _check_for_cycle(self, variable, period):
          
          previous_periods = [_period for (_name, _period) in self.computation_stack if _name == variable.name]
          self.computation_stack.append((variable.name, str(period)))
          if str(period) in previous_periods:
              raise CycleError("Circular definition detected on formula {}@{}".format(variable.name, period))
          spiral = len(previous_periods) >= self.max_spiral_loops
          if spiral:
              self.invalidate_spiral_variables(variable)
              message = "Quasicircular definition detected on formula {}@{} involving {}".format(variable.name, period, self.computation_stack)
              raise SpiralError(message, variable.name)
docs: Raise an exception in the case of a circular definition, where evaluating a variable for
          a given period loops around to evaluating the same variable/period pair. Also guards, as
          a heuristic, against "quasicircles", where the evaluation of a variable at a period involves
          the same variable at a different period.