code: def setup_file_watcher(path, use_polling=False):
      
      if use_polling:
          observer_class = watchdog.observers.polling.PollingObserver
      else:
          observer_class = EVENTED_OBSERVER
  
      file_event_handler = _SourceChangesHandler(patterns=["*.py"])
      file_watcher = observer_class()
      file_watcher.schedule(file_event_handler, path, recursive=True)
      file_watcher.start()
      return file_watcher
docs: Sets up a background thread that watches for source changes and
      automatically sends SIGHUP to the current process whenever a file
      changes.