import signal
[docs]
class TimeoutException(Exception):
"""Custom exception to indicate a timeout."""
pass
[docs]
def timeout_handler(signum, frame):
"""Handler function that raises TimeoutException."""
raise TimeoutException("Function execution exceeded the timeout.")