from typing import List


def match_by_name(imagenames:List[str], masknames: List[str], x_suffix='.tif', y_suffix='_tissue.tif'):
    """Match files by their name ingoring suffixes."""
    new_imagenames, new_masknames = [], []
    for x in imagenames:
        for y in masknames:
            if x == y or x[:-len(x_suffix)] == y[:-len(y_suffix)]:
                new_imagenames.append(x)
                new_masknames.append(y)
    return new_imagenames, new_masknames