def rm_rf(path):
    def _onerror(func, path, exc_info):
        '''
        Error handler for `shutil.rmtree`.

        If the error is due to an access error (read only file)
        it attempts to add write permission and then retries.

        If the error is for another reason it re-raises the error.

        Usage : `shutil.rmtree(path, onerror=onerror)`
        '''
        if is_windows() and not os.access(path, os.W_OK):
            # Is the error an access error ?
            os.chmod(path, stat.S_IWUSR)
            func(path)
        else:
            raise  # pylint: disable=E0704

    shutil.rmtree(path, onerror=_onerror)
Convert IMAP4 flags response to python tuple.
dataset/ETHPy150Open saltstack/salt/salt/utils/__init__.py/rm_rf--crossover with--dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/imaplib.py/ParseFlags