def METHOD_NAME (self):
    while (not self.kill_event.is_set()):
        start_time = datetime.now()
        if not self.stop_event.is_set():
            self.algorithm()
        finish_Time = datetime.now()
        dt = finish_Time - start_time
        ms = (dt.days * 24 * 60 * 60 + dt.seconds) * 1000 + dt.microseconds / 1000.0
        #print (ms)
        if (ms < time_cycle):
            time.sleep((time_cycle - ms) / 1000.0)