def options(self, **options):
        """A context-manager for setting connection options; the original
        values of the options will be restored when the context-manager exits.
        For example::

            with c.options(gui_mode = False):
                 c.cmd.vol_list()
        """
        self._contexts.append(self._contexts[-1].copy())
        self.set_options(**options)
        try:
            yield
        finally:
            self._contexts.pop(-1)