CLN: consolidate compression inference as much as possible (original) (raw)

we have 3 copies of the compression inference routines in parser.py, parser.py, and io/common.py. See how much we can reduce this (some is necessary as sometimes we need to actually return a file handle or need to read in and re-wrap).

xref #12175