def cleanUpManifests():
    """Removes any manifest files that are no longer in use by this client"""
    manifest_dir = os.path.join(
        munkicommon.pref('ManagedInstallDir'), 'manifests')

    exceptions = [
        "SelfServeManifest"
    ]

    for (dirpath, dirnames, filenames) in os.walk(manifest_dir, topdown=False):
        for name in filenames:

            if name in exceptions:
                continue

            abs_path = os.path.join(dirpath, name)
            rel_path = abs_path[len(manifest_dir):].lstrip("/")

            if rel_path not in MANIFESTS.keys():
                os.unlink(abs_path)

        # Try to remove the directory
        # (rmdir will fail if directory is not empty)
        try:
            if dirpath != manifest_dir:
                os.rmdir(dirpath)
        except __HOLE__:
            pass
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/cleanUpManifests