Configure our tab completion settings for a context and then
        restore them to previous settings on exit.

def setup_readline(self):
        """ Configure our tab completion settings for a context and then
        restore them to previous settings on exit. """
        readline.parse_and_bind('tab: complete')
        completer_save = readline.get_completer()
        delims_save = readline.get_completer_delims()
        delims = set(delims_save)
        delims |= self.completer_delim_includes
        delims -= self.completer_delim_excludes
        readline.set_completer(self.completer_hook)
        try:
            readline.set_completer_delims(''.join(delims))
            try:
                yield
            finally:
                readline.set_completer_delims(delims_save)
        finally:
            readline.set_completer(completer_save)