replaced cStringIO with StringIO to make python26 happy
Added multiline support