def by_type(blocks, slist=None):
    layout = []
    data = []
    int_vol = []
    unknown = []
    for i in blocks:
        if slist and i not in slist:
            continue
        if blocks[i].is_vtbl and blocks[i].is_valid:
            layout.append(i)
        elif blocks[i].is_internal_vol and blocks[i].is_valid:
            int_vol.append(i)
        elif blocks[i].is_valid:
            data.append(i)
        else:
            unknown.append(i)
    return layout, data, int_vol, unknown