code: def timeout(duration, formula):
      def timeout_handler(signum, frame):
          raise Exception(
              f"'{formula}': timed out after {duration} seconds"
          )
  
      signal.signal(signal.SIGALRM, timeout_handler)
      signal.alarm(duration)
      yield
      signal.alarm(0)
  
imports: from contextlib import contextmanager
  import signal
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: timeout(duration, formula) without return types