def group_pairs(blocks, layout_blocks_list):
    """Sort a list of layout blocks into pairs

    Arguments:
    List:blocks        -- List of block objects
    List:layout_blocks -- List of layout block indexes

    Returns:
    List -- Layout block pair indexes grouped in a list
    """
    layouts_grouped = [[blocks[layout_blocks_list[0]].peb_num]]

    for l in layout_blocks_list[1:]:
        for lnd in layouts_grouped:
            if blocks[l].vtbl_recs[0].name == blocks[lnd[0]].vtbl_recs[0].name:
                lnd.append(blocks[l].peb_num)
                break

        else:
                layouts_grouped.append([blocks[l].peb_num])

    return layouts_grouped