def decode_tbs(byts, flag_size=4):
 byts = bytes(byts)
 (val, flags, consumed) = decode_fvwi(byts, flag_size=flag_size)
 extra = {}
 byts = byts[consumed:]
 if ((flags & 8) and (flag_size > 3)):
  extra[8] = True
 if (flags & 2):
  (x, consumed2) = decint(byts)
  byts = byts[consumed2:]
  extra[2] = x
  consumed += consumed2
 if (flags & 4):
  extra[4] = ord(byts[0])
  byts = byts[1:]
  consumed += 1
 if (flags & 1):
  (x, consumed2) = decint(byts)
  byts = byts[consumed2:]
  extra[1] = x
  consumed += consumed2
 return (val, extra, consumed)

def decode_tbs ( byts , flag_size = 4 ) : byts = bytes ( byts ) ( val , flags , consumed ) = decode_fvwi ( byts , flag_size = flag_size ) extra = { } byts = byts [ consumed : ] if ( ( flags & 8 ) and ( flag_size > 3 ) ) : extra [ 8 ] = True if ( flags & 2 ) : ( x , consumed2 ) = decint ( byts ) byts = byts [ consumed2 : ] extra [ 2 ] = x consumed += consumed2 if ( flags & 4 ) : extra [ 4 ] = ord ( byts [ 0 ] ) byts = byts [ 1 : ] consumed += 1 if ( flags & 1 ) : ( x , consumed2 ) = decint ( byts ) byts = byts [ consumed2 : ] extra [ 1 ] = x consumed += consumed2 return ( val , extra , consumed )
trailing byte sequences for indexing consists of series of fvwi numbers .