def reindent(s, numSpaces): s = string.split(s, '\n') s = [(numSpaces * ' ') + string.lstrip(line) for line in s] s = string.join(s, '\n') return s