docs: def _handle_autoreload(self,cfg_file,*args,**options):
          """Command 'supervisor autoreload' watches for code changes.
  
          This command provides a simulation of the Django dev server's
          auto-reloading mechanism that will restart all supervised processes.
  
          It's not quite as accurate as Django's autoreloader because it runs
          in a separate process, so it doesn't know the precise set of modules
          that have been loaded. Instead, it tries to watch all python files
          that are "nearby" the files loaded at startup by Django.
          """
          if args:
              raise CommandError("supervisor autoreload takes no arguments")
          live_dirs = self._find_live_code_dirs()
          reload_progs = self._get_autoreload_programs(cfg_file)
  
          def autoreloader():
              """
              Forks a subprocess to make the restart call.
              Otherwise supervisord might kill us and cancel the restart!
              """
              if os.fork() == 0:
                  sys.exit(self.handle("restart", *reload_progs, **options))
  
          # Call the autoreloader callback whenever a .py file changes.
          # To prevent thrashing, limit callbacks to one per second.
          handler = CallbackModifiedHandler(callback=autoreloader,
                                            repeat_delay=1,
                                            patterns=AUTORELOAD_PATTERNS,
                                            ignore_patterns=AUTORELOAD_IGNORE,
                                            ignore_directories=True)
  
          # Try to add watches using the platform-specific observer.
          # If this fails, print a warning and fall back to the PollingObserver.
          # This will avoid errors with e.g. too many inotify watches.
          from watchdog.observers import Observer
          from watchdog.observers.polling import PollingObserver
          
          observer = None
          for ObserverCls in (Observer, PollingObserver):
              observer = ObserverCls()
              try:
                  for live_dir in set(live_dirs):
                      observer.schedule(handler, live_dir, True)
                  break
              except Exception:
                  print>>sys.stderr, "COULD NOT WATCH FILESYSTEM USING"
                  print>>sys.stderr, "OBSERVER CLASS: ", ObserverCls
                  traceback.print_exc()
                  observer.start()
                  observer.stop()
  
          # Fail out if none of the observers worked.
          if observer is None:
              print>>sys.stderr, "COULD NOT WATCH FILESYSTEM"
              return 1
  
          # Poll if we have an observer.
          # TODO: Is this sleep necessary?  Or will it suffice
          # to block indefinitely on something and wait to be killed?
          observer.start()
          try:
              while True:
                  time.sleep(1)
          except KeyboardInterrupt:
              observer.stop()
          observer.join()
          return 0