Take a look at the textwrap docs here http://docs.python.org/lib/module-textwrap.html You should be able to use initial_indent and subsequent_indent for the left side spaces. For spaces on the right side, reducing width by 2 should get that, but I have never used textwrap. Also, it is not meant to be a total solution so you may have to write your own.