def margin ( text ) : lines = str ( text ) . split ( '\n' ) return '\n' . join ( '  {}  ' . format ( l ) for l in lines )
is there a equivalent of a margin command in python
r Add a margin to both ends of each line in the string .
def margin(text):
    r"""Add a margin to both ends of each line in the string.

    Example:
        >>> margin('line1\nline2')
        '  line1  \n  line2  '
    """
    lines = str(text).split('\n')
    return '\n'.join('  {}  '.format(l) for l in lines)