A backend can print multiline messages by prefixing the message with either DEBUG:, INFO:, WARNING: or ERROR:, and escaping the newlines (msg.replace('\n', r'\n')).
msg.replace('\n', r'\n')