1 from io
import StringIO
2 from textwrap
import indent
5 class CodeWriter(StringIO
):
11 def write(self
, msg
, depth
=0):
13 prefix
= self
.INDENT
* depth
14 msg
= indent(msg
, prefix
)
16 return super(CodeWriter
, self
).write(msg
)
19 return super(CodeWriter
, self
).getvalue()