from io import StringIO


def _join(args):
    """
    Join the arguments with spaces, except newlines which don't
    need to be padded.
    """
    result = StringIO()
    skipSpace = True
    for arg in args:
        if skipSpace:
            skipSpace = False
        else:
            result.write(' ')
        if arg == '\n':
            skipSpace = True
        result.write(arg)
    return result.getvalue()