def METHOD_NAME(self, gpio, level, tick):
    if level == 1:  # Rising edge.
        if self._high_tick is not None:
            t = self.pigpio.tickDiff(self._high_tick, tick)
            if self._period is not None:
                self._period = (self._old * self._period) + (self._new * t)
            else:
                self._period = t
        self._high_tick = tick
    elif level == 2:  # Watchdog timeout.
        if self._period is not None:
            if self._period < 2000000000:
                self._period += self._watchdog * 1000