Is there a Python module for transparently working with a file-like object as a buffer?
<p>I'm working on a pure Python parser, where the input data may range in size from kilobytes to gigabytes. Is there a module that wraps a file-like object and abstracts explicit .open()/.seek()/.read()/.close() calls into a simple buffer-like object? You might think of this as the inverse of StringIO. I expect it might look something like:</p>

<pre><code>with FileLikeObjectBackedBuffer(urllib.urlopen("http://www.google.com")) as buf:
    header = buf[0:0x10]
    footer = buf[-0x10:]
</code></pre>

<p>Note, I asked a <a href="http://stackoverflow.com/questions/14017349/is-there-a-python-module-for-transparently-working-with-a-files-contents-as-a-b">similar quesetion</a> yesterday, and accepted <code>mmap</code>ing a file.  Here, I am specifically looking for a module that wraps a file-like object (for argument's sake, say like what is returned by <code>urllib</code>).</p>
