How the classes parameter of .label_from_func() work?

codes = np.loadtxt(path/'codes.txt', dtype=str); codes

src = (SegmentationItemList.from_folder(path_img)
       .label_from_func(get_y_fn, classes=codes))

As I understand, get_y_func returns y values (here the path to mask images) and the codes array is used to translate numbers in the mask to actual strings. How fastai knows which number corresponds to which string label in the mask? Unfortunately, docs for label_from_func() tell nothing about the classes parameter and Iā€™m not experienced enough to understand the source code.