'This hook can replace sys.excepthook (for Python 2.1 or higher).'

def __call__(self, etype=None, evalue=None, etb=None):

    if (etb is None):
        self.handler()
    else:
        self.handler((etype, evalue, etb))
    try:
        self.debugger()
    except KeyboardInterrupt:
        print '\nKeyboardInterrupt'
