code: def timeout(seconds=1):
      """
      Executes code only  limited seconds. If the code does not end during this time, it will be interrupted.
  
      :param seconds: Number of seconds
      """
  
      def handle_timeout(signum, frame):
          raise TimeoutException("Process timed out.")
  
      try:
          signal.signal(signal.SIGALRM, handle_timeout)
          signal.alarm(seconds)
      except ValueError:
          raise Exception(
              "timeout can't be used in the current context"
          )
  
      try:
          yield
      except TimeoutException:
          print("Process timed out.")
  
      finally:
          try:
              signal.alarm(0)
          except ValueError:
              raise Exception(
                  "timeout can't be used in the current context"
              )
  
file_path: airflow/tests/test_utils/perf/perf_kit/repeat_and_time.py
imports: from __future__ import annotations
  import contextlib
  import functools
  import math
  import random
  import signal
  import time
label_desc: Use image node_id 3 for calling a global function with example usage: timeout(seconds) without return types