Get and format completer choices.  Note that all internal calls to
        completer functions must use [frozen]set()s.

def complete(self, text, line, begin, end):
        """ Get and format completer choices.  Note that all internal calls to
        completer functions must use [frozen]set()s. """
        self.fire_event('precomplete', text, line, begin, end)
        choices = self._complete(text, line, begin, end)
        choices -= self.completion_excludes
        sz = len(choices)
        if sz == 1:
            # XXX: This is pretty bad logic here.  In reality we need much
            # more complicated escape handling and imbalanced quote support.
            return set(shlex.quote(x) for x in choices)
        elif sz > 2:
            # We don't need the sentinel choice to prevent completion
            # when there is already more than 1 choice.
            choices -= {completer.ActionCompleter.sentinel}
        self.fire_event('postcomplete', choices)
        return choices