import functools


def add_keyboard_interrupt(func):
    """
    Decorator to detect keyboard interrupts by user.
    """
    @functools.wraps(func)
    def wrapper():
        try:
            func()
        except KeyboardInterrupt:
            print('Operation interrupted by user.')
    return wrapper