def METHOD_NAME(wan, anim_presence):
    wan_files = []
    for anim_list in anim_presence:
        animGroupData = []
        for anim_idx, anim_group in enumerate(anim_list):
            if not anim_group:
                animGroupData.append([])
            elif anim_idx < len(wan.animGroupData):
                new_anim = exWanUtils.duplicateAnimGroup(wan.animGroupData[anim_idx])
                animGroupData.append(new_anim)
            else:
                animGroupData.append([])
        frameData = []
        offsetData = []
        # adds only necessary frames to frameData, and remaps frame references in animGroupData
        # offset data included
        transferStrippedFrameData(
            wan.frameData, frameData, wan.offsetData, offsetData, animGroupData
        )
        # add only necessary pieces to imgData, and remaps the image piece references in frameData
        imgData = []
        transferStrippedImgData(wan.imgData, imgData, frameData)
        new_wan = WanFile()
        new_wan.imgData = imgData
        new_wan.frameData = frameData
        new_wan.animGroupData = animGroupData
        new_wan.offsetData = offsetData
        new_wan.customPalette = wan.customPalette
        new_wan.sdwSize = wan.sdwSize
        wan_files.append(new_wan)
    return wan_files