<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _parse_section_v2(self, data):
        ''' Parses a sequence of packets in data.

        The sequence is terminated by a packet with a field type of EOS
        :param data bytes to be deserialized.
        :return: the rest of data and an array of packet V2
        '''

        from pymacaroons.exceptions import MacaroonDeserializationException

        prev_field_type = -1
        packets = []
        while True:
            if len(data) == 0:
                raise MacaroonDeserializationException(
                    'section extends past end of buffer')
            rest, packet = self._parse_packet_v2(data)
            if packet.field_type == self._EOS:
                return rest, packets
            if packet.field_type <= prev_field_type:
                raise MacaroonDeserializationException('fields out of order')
            packets.append(packet)
            prev_field_type = packet.field_type
            data = rest