code: def must_stop(self):
          
          return bool(self.terminate_gracefuly and self.end_signal_caught
                   or self.num_loops >= self.max_loops or self.end_forced
                   or self.wanted_end_date and datetime.utcnow() >= self.wanted_end_date)
docs: Return True if the worker must stop when the current loop is over.