Use splitlines instead of regex

Regex needed to be r'[\n\r]+' anyway to account for multiple os's.
Splitlines is probably more robust.
Use repr in send command, not string literal

Pretty up PY_CMD_TEMPLATE.