def cmd_and_response(self, cmd):
        self.send(cmd + '\n')
        output = self.read_to_next_prompt()
        # readline trying to be friendly- remove these artifacts
        output = output.replace(' \r', '')
        output = output.replace('\r', '')
        output = output.replace(' \b', '')
        if self.tty:
            echo, output = output.split('\n', 1)
            assert echo == cmd, "unexpected echo %r instead of %r" % (echo, cmd)
        try:
            output, promptline = output.rsplit('\n', 1)
        except ValueError:
            promptline = output
            output = ''
        assert re.match(self.prompt, '\n' + promptline), \
                'last line of output %r does not match %r?' % (promptline, self.prompt)
        return output + '\n'
dataset/ETHPy150Open francelabs/datafari/cassandra/pylib/cqlshlib/test/run_cqlsh.py/CqlshRunner.cmd_and_response/original