docs: def safe_process_files(path, files, args, state):
      """
      Process a number of files in a directory. Catches any exception from the
      processing and checks if we should fail directly or keep going.
      """
      for fn in files:
          full_fn = os.path.join(path, fn)
          try:
              if not process_file(path, fn, args, state):
                  return False
          except Exception, e:
              sys.stderr.write("error: %s\n%s\n" % (os.path.join(path, fn), traceback.format_exc()))
              state.log_failed(full_fn)
          if state.should_quit():
              return False
      return True