@staticmethod<EOL><INDENT>def to_packets(pages, strict=False):<DEDENT>
serial = pages[<NUM_LIT:0>].serial<EOL>sequence = pages[<NUM_LIT:0>].sequence<EOL>packets = []<EOL>if strict:<EOL><INDENT>if pages[<NUM_LIT:0>].continued:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not pages[-<NUM_LIT:1>].complete:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>elif pages and pages[<NUM_LIT:0>].continued:<EOL><INDENT>packets.append([b"<STR_LIT>"])<EOL><DEDENT>for page in pages:<EOL><INDENT>if serial != page.serial:<EOL><INDENT>raise ValueError("<STR_LIT>" % page)<EOL><DEDENT>elif sequence != page.sequence:<EOL><INDENT>raise ValueError("<STR_LIT>" % page)<EOL><DEDENT>else:<EOL><INDENT>sequence += <NUM_LIT:1><EOL><DEDENT>if page.continued:<EOL><INDENT>packets[-<NUM_LIT:1>].append(page.packets[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>packets.append([page.packets[<NUM_LIT:0>]])<EOL><DEDENT>packets.extend([p] for p in page.packets[<NUM_LIT:1>:])<EOL><DEDENT>return [b"<STR_LIT>".join(p) for p in packets]<EOL>
Construct a list of packet data from a list of Ogg pages.

        If strict is true, the first page must start a new packet,
        and the last page must end the last packet.