<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_signal_handler():
 """Adds a signal handler to handle KeyboardInterrupt."""

    import signal

    def handler(sig, frame):
        if sig == signal.SIGINT:
            librtmp.RTMP_UserInterrupt()
            raise KeyboardInterrupt

    signal.signal(signal.SIGINT, handler)