Read a command from the user line by line.

        Returns a code object suitable for execution.

def read_command(self):
        """Read a command from the user line by line.

        Returns a code object suitable for execution.
        """

        reader = self.reader

        line = yield from reader.readline()
        if line == b'':  # lost connection
            raise ConnectionResetError()

        try:
            # skip the newline to make CommandCompiler work as advertised
            codeobj = self.attempt_compile(line.rstrip(b'\n'))
        except SyntaxError:
            yield from self.send_exception()
            return

        return codeobj