def METHOD_NAME(self, regions, level, classes=None):
    from .constants import PAGE_REGION_TYPES  # pylint: disable=relative-beyond-top-level,import-outside-toplevel
    if level == 1:
        # stop recursion, filter classes
        if classes:
            return [r for r in regions if self._region_class(r) in classes]
        if regions and regions[0].__class__.__name__ == 'PageType':
            regions = regions[1:]
        return regions
    # find more regions recursively
    more_regions = []
    for region in regions:
        more_regions.append([])
        for class_ in PAGE_REGION_TYPES:
            if class_ == 'Map' and not isinstance(region, PageType): # pylint: disable=undefined-variable
                # 'Map' is not recursive in 2019 schema
                continue
            more_regions[-1] += getattr(region, 'get_{}Region'.format(class_))()
    if not any(more_regions):
        return self.METHOD_NAME(regions, 1, classes)
    ret = []
    for r, more in zip(regions, more_regions):
        ret.append(r)
        ret += self.METHOD_NAME(more, level - 1 if level else 0, classes)
    return self.METHOD_NAME(ret, 1, classes)