def do_cleanup(root):
    for path, dirs, files in os.walk(root):
        for file in itertools.chain(dirs, files):
            try:
                for pattern in file_patterns:
                    if fnmatch.fnmatch(file, pattern):
                        fullpath = os.path.join(path, file)
                        if os.path.isdir(fullpath):
                            shutil.rmtree(fullpath, ignore_errors=False)
                        else:
                            os.unlink(fullpath)
                        print('Deleted', fullpath)
            except __HOLE__:
                pass
dataset/ETHPy150Open eliben/pycparser/_clean_tables.py/do_cleanup