code: def watchdog(sleep_interval):
      
      mtimes = {}
      worker_process = restart_with_reloader()
      signal.signal(
          signal.SIGTERM, lambda *args: kill_program_completly(worker_process)
      )
      signal.signal(
          signal.SIGINT, lambda *args: kill_program_completly(worker_process)
      )
      while True:
          for filename in _iter_module_files():
              try:
                  mtime = os.stat(filename).st_mtime
              except OSError:
                  continue
  
              old_time = mtimes.get(filename)
              if old_time is None:
                  mtimes[filename] = mtime
                  continue
              elif mtime > old_time:
                  kill_process_children(worker_process.pid)
                  worker_process.terminate()
                  worker_process = restart_with_reloader()
                  mtimes[filename] = mtime
                  break
  
          sleep(sleep_interval)
docs: Watch project files, restart worker process if a change happened.
  
      :param sleep_interval: interval in second.
      :return: Nothing