def METHOD_NAME(agent):
    event = threading.Event()
    def signal_handler(signum, frame):
        event.set()
    for signum in [signal.SIGTERM, signal.SIGINT]:
        signal.signal(signum, signal_handler)
    agent.start()
    event.wait()
    agent.stop()