def delete_empty_dirs(folder):
    for root, _, _ in os.walk(folder, topdown=False):
        try:  # Take advantage that os.rmdir does not delete non-empty dirs
            os.rmdir(root)
        except __HOLE__:
            pass  # not empty
dataset/ETHPy150Open conan-io/conan/conans/util/files.py/delete_empty_dirs