def _find_candidates_for_deletion(master_dir):
    for filename in os.listdir(master_dir):
        filename = os.path.join(master_dir, filename)
        stat = os.stat(filename)
        if not os.path.isfile(filename) or stat.st_nlink > 1:
            continue
        # NOTE(dtantsur): Detect most recently accessed files,
        # seeing atime can be disabled by the mount option
        # Also include ctime as it changes when image is linked to
        last_used_time = max(stat.st_mtime, stat.st_atime, stat.st_ctime)
        yield filename, last_used_time, stat
Find files eligible for deletion i.e. with link count ==1.
dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/image_cache.py/_find_candidates_for_deletion