Detector to catch signals in a python function