I just looked into using StringIO, but unfortunately because we are writing to the object and then reads of the same object would need to start from the beginning (requiring a rewind call) this would then upset further writes to the object (because they would then start writing at the top).  With an actual file I can open two references to it (one for reading and one for writing) so I can maintain two separate pointers into the file.