This is fucking bullshit. It works, but it's fucking ugly and I can't help but feel that I just don't grok the difference between a python file, fileobject, stringio, ugh.