code: def parse_subpackets(s):
      
      subpackets = []
      total_size = s.readfmt('>H')
      data = s.read(total_size)
      s = util.Reader(io.BytesIO(data))
  
      while True:
          try:
              first = s.readfmt('B')
          except EOFError:
              break
  
          if first < 192:
              subpacket_len = first
          elif first < 255:
              subpacket_len = ((first - 192) << 8) + s.readfmt('B') + 192
          else:  # first == 255
              subpacket_len = s.readfmt('>L')
  
          subpackets.append(s.read(subpacket_len))
  
      return subpackets
docs: See https://tools.ietf.org/html/rfc4880#section-5.2.3.1 for details.