code: def by_vol_id(blocks, slist=None):
      
  
      vol_blocks = {}
  
      # sort block by volume
      # not reliable with multiple partitions (fifo)
  
      for i in blocks:
          if slist and i not in slist:
              continue
          elif not blocks[i].is_valid:
              continue
  
          if blocks[i].vid_hdr.vol_id not in vol_blocks:
              vol_blocks[blocks[i].vid_hdr.vol_id] = []
  
          vol_blocks[blocks[i].vid_hdr.vol_id].append(blocks[i].peb_num)
  
      return vol_blocks
docs: Sort blocks by volume id
  
      Arguments:
      Obj:blocks -- List of block objects.
      List:slist     -- (optional) List of block indexes.
  
      Return:
      Dict -- blocks grouped in lists with dict key as volume id.