'Switch modes for the exception handlers.
Valid modes: Plain, Context and Verbose.
If called without arguments, acts as a toggle.'

@line_magic
def xmode(self, parameter_s=''):

    def xmode_switch_err(name):
        warn(('Error    changing    %s    exception    modes.\n%s' % (name, sys.exc_info()[1])))
    shell = self.shell
    new_mode = parameter_s.strip().capitalize()
    try:
        shell.InteractiveTB.set_mode(mode=new_mode)
        print ('Exception    reporting    mode:', shell.InteractiveTB.mode)
    except:
        xmode_switch_err('user')
