def complete(self, text, state):
        if state == 0:
            if text:
                # self.matches = [opt for opt in self.opts if opt.startswith(text)]
                # self.matches = match_anywhere(text, self.opts)
                self.matches = match_fuzzy(text, self.opts, color=True)
            else:
                self.matches = self.opts[:]
        logging.debug('[matches] {}'.format(self.matches))

        try:
            response =  self.matches[state]
            if self.limit > 0:
                if state == self.limit:
                    response = '...'
                elif state > self.limit:
                    response = None
        except IndexError:
            response = None
        logging.debug('Text {}, state {}, response {}'.format(
                      text, state, response))
        return response
 def test_basic(self):
     for _str, match in self.str_to_match:
         self.assertListEqual(match_fuzzy(_str, self.words), match)