def _rl_completer(self, text, state):
        if state == 0:
            curr = readline.get_line_buffer()
            b = readline.get_begidx()
            if b == 0:
                complist = self._cmd.get_completion_scope("commands")
            else: # complete based on scope keyed on previous word
                word = curr[:b].split()[-1]
                complist = self._cmd.get_completion_scope(word)
            self._complist = filter(lambda s: s.startswith(text), complist)
        try:
            return self._complist[state]
        except __HOLE__:
            return None
dataset/ETHPy150Open kdart/pycopia/fepy/pycopia/fepy/CLI.py/CommandParser._rl_completer