sanitize dynamic data while constructing commands
split lines using \r\n as required by the protocol
accept any received linebreaks, not just \n

there is no guarantee that the remote encodes linebreaks inside the
encrypted message as \n. splitlines() takes care of any deviations.