Incorrect extraction of the file suffix

Hi all,
I am trying to read files from a directory and use them later for a segmentation task.
I wrote the get_msk function as suggested here (Practical-Deep-Learning-for-Coders)
The above function contains the line fn = path/f'{fn.stem}_seg.png', where I would select the masks, characterized by the suffix _seg.png'

image name = ./MyPath/4730043/43_tile10x11.jpg
mask name = ./MyPath/4730043/43_tile10x11_seg.png

When I run the dataloader dls = dblk.dataloaders('./MyDataset', bs=8) I get an error because it can not find (at example) the file 43_tile10x11_seg_seg.png where the suffix _seg is repeated.

I suspect that this kind of error is due to the aforementioned fn path, but I am not sure about it.
How could I fix this issue?

Note: this the lambda function get_y = lambda o: get_msk(o, p2c) applied by the dataloader.