def METHOD_NAME(task, dry_run, progress_logger=None, cleanup_progress=None):
    """
    Cleanup cache level on file system level.
    """
    for level in task.levels:
        level_dir = task.tile_manager.cache.level_location(level)
        if dry_run:
            def file_handler(filename):
                print('removing ' + filename)
        else:
            file_handler = None
        if progress_logger:
            progress_logger.log_message('removing old tiles in ' + normpath(level_dir))
            if progress_logger.progress_store:
                cleanup_progress.step_dir(level_dir)
                if cleanup_progress.already_processed():
                    continue
                progress_logger.progress_store.add(
                    task.id,
                    cleanup_progress.current_progress_identifier(),
                )
                progress_logger.progress_store.write()
        cleanup_directory(level_dir, task.remove_timestamp,
            file_handler=file_handler, remove_empty_dirs=True)