Decorator class to catch keyboard interrupts on a given function