Instead of storing a list of strings, then ```join``` them and use ```StringIO``` on the final string, could you consider a more memory efficient strategy (e.g. storing directly the final string)?