def _get_completions(self, inputstring, split_completed_lines=True):
        self.cqlsh.send(inputstring)
        self.cqlsh.send(TAB)
        immediate = self.cqlsh.read_up_to_timeout(COMPLETION_RESPONSE_TIME)
        immediate = immediate.replace(' \b', '')
        self.assertEqual(immediate[:len(inputstring)], inputstring)
        immediate = immediate[len(inputstring):]
        immediate = immediate.replace(BEL, '')

        if immediate:
            return immediate

        self.cqlsh.send(TAB)
        choice_output = self.cqlsh.read_up_to_timeout(COMPLETION_RESPONSE_TIME)
        if choice_output == BEL:
            choice_output = ''

        self.cqlsh.send(CTRL_C)  # cancel any current line
        self.cqlsh.read_to_next_prompt()

        choice_lines = choice_output.splitlines()
        if choice_lines:
            # ensure the last line of the completion is the prompt
            prompt_regex = self.cqlsh.prompt.lstrip() + re.escape(inputstring)
            msg = ('Double-tab completion '
                   'does not print prompt for input "{}"'.format(inputstring))
            self.assertRegexpMatches(choice_lines[-1], prompt_regex, msg=msg)

        choice_lines = [line.strip() for line in choice_lines[:-1]]
        choice_lines = [line for line in choice_lines if line]

        if split_completed_lines:
            completed_lines = map(set, (completion_separation_re.split(line.strip())
                               for line in choice_lines))

            if not completed_lines:
                return set()

            completed_tokens = set.union(*completed_lines)
            return completed_tokens - {''}
        else:
            return choice_lines

        assert False
Get results of tab completion in cqlsh. Returns a bare string if a
dataset/ETHPy150Open francelabs/datafari/cassandra/pylib/cqlshlib/test/test_cqlsh_completion.py/CqlshCompletionCase._get_completions