def indent ( text , amount , ch = ' ' ) : padding = amount * ch return '' . join ( padding + line for line in text . splitlines ( True ) )
python insert \n after a certain number of white spaces
Indents a string by the given amount of characters .
def indent(text, amount, ch=' '):
    """Indents a string by the given amount of characters."""
    padding = amount * ch
    return ''.join(padding+line for line in text.splitlines(True))