human
Complete this python program:
def ignore_sigint(func):
assistant
#Here is the Python program you requested.

    """This decorator registers a custom SIGINT handler to catch and ignore SIGINT
    until the wrapped function is completed.
    """
    @wraps(func)
    def wrapped(*args, **kwargs):
        curr_thread = threading.currentThread()
        single_thread = ((threading.activeCount() == 1) and (curr_thread.getName() == 'MainThread'))
        class SigintHandler(object, ):
            def __init__(self):
                self.sigint_received = False
            def __call__(self, signum, frame):
                warnings.warn('KeyboardInterrupt    ignored    until    {}    is    complete!'.format(func.__name__), AstropyUserWarning)
                self.sigint_received = True
        sigint_handler = SigintHandler()
        if single_thread:
            old_handler = signal.signal(signal.SIGINT, sigint_handler)
        try:
            func(*args, **kwargs)
        finally:
            if single_thread:
                if (old_handler is not None):
                    signal.signal(signal.SIGINT, old_handler)
                else:
                    signal.signal(signal.SIGINT, signal.SIG_DFL)
                if sigint_handler.sigint_received:
                    raise KeyboardInterrupt
    return wrapped