code: def chmod_and_retry(func, path, exc_info):
      
      if func is os.listdir or os.name != 'nt':
          raise
      os.chmod(path, stat.S_IREAD | stat.S_IWRITE)
      # on error,this will raise.
      func(path)
docs: Define an error handler to pass to shutil.rmtree.
      On Windows, when a file is marked read-only as git likes to do, rmtree will
      fail. To handle that, on errors try to make the file writable.
      We want to retry most operations here, but listdir is one that we know will
      be useless.