I'm not sure how to perform this operation in Python. The difficulty is
in knowing the size of the output buffer: if it is too small, I get an
"insufficient buffer" exception; too large, and I get an "end of file"
exception. In neither case is any partial data available.
I'd rather not resort to a binary seach...