Okay, I'll commit the abstraction shortly, but in this place, it's difficult to use because of problems with testing. The test fixtures and mocking are a bit scary and I couldn't get it to work. I still have instantiate a StringIO here. But I've removed the duplication elsewhere.