def cleanpycs(root, exclude='CVS .svn .git .hg .bzr'.split()):
    '''Deletes .pyc files and empty directories under this directory.

    Directories in ``exclude`` are not traversed.
    '''
    from os.path import join, normpath
    from os import listdir, remove, rmdir
    exclude = frozenset(exclude)
    for dir, subdirs, files, top in walk2(root):
        if top:
            for f in files:
                if f.endswith('.pyc'):
                    remove(join(dir,f))
            subdirs[:] = [d for d in subdirs if d not in exclude]
        elif not listdir(dir):
            rmdir(dir)
Deletes .pyc files and empty directories under this directory.

    Directories in ``exclude`` are not traversed.
    
recipes/Python/577206_Simultaneous_topdown_bottomvariant_oswalk_alt/recipe-577206.py