code: def group_pairs(blocks, layout_blocks_list):
      
  
      image_dict={}
      for block_id in layout_blocks_list:
          image_seq=blocks[block_id].ec_hdr.image_seq
          if image_seq not in image_dict:
              image_dict[image_seq]=[block_id]
          else:
              image_dict[image_seq].append(block_id)
  
      log(group_pairs, 'Layout blocks found at PEBs: %s' % list(image_dict.values()))
  
      return list(image_dict.values())
docs: 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