<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run_forever(self):
 """ Causes the worker to run either forever or until the ``Worker.max_tasks`` are reached. """

        self.starting()
        self.keep_running = True

        def handle(signum, frame):
            self.interrupt()
            self.keep_running = False

        signal.signal(signal.SIGINT, handle)

        while self.keep_running:
            if self.max_tasks and self.tasks_complete >= self.max_tasks:
                self.stopping()

            if self.gator.len():
                result = self.gator.pop()
                self.tasks_complete += 1
                self.result(result)

            if self.nap_time >= 0:
                time.sleep(self.nap_time)

        return 0