code: def trace_trains(
      stream=None, level=1, exclude_prefixes=[], only_prefix=[]
  ):
      """
      DEBUG ONLY - Add full ClearML package code trace
      Output trace to filename or stream, default is sys.stderr
      Trace level
          -2: Trace function and arguments and returned call
          -1: Trace function call (no arguments) and returned call
          0: Trace disabled
          1: Trace function call (no arguments). This is the default
          2: Trace function and arguments
  
      :param stream: stream or filename for trace log (default stderr)
      :param int level: Trace level
      """
      global __patched_trace, __stream_write, __stream_flush, __trace_level, __trace_start, __thread_id, __thread_so
      __trace_level = level
      if __patched_trace:
          return
      __patched_trace = True
      if not __thread_id:
          if sys.platform == "linux":
              import ctypes
  
              __thread_so = ctypes.cdll.LoadLibrary("libc.so.6")
              __thread_id = _thread_linux_id
          else:
              __thread_id = _thread_py_id
  
      stderr_write = (
          sys.stderr._original_write
          if hasattr(sys.stderr, "_original_write")
          else sys.stderr.write
      )
      if stream:
          if isinstance(stream, str):
              stream = open(stream, "w")
          __stream_write = stream.write
          __stream_flush = stream.flush
      else:
          __stream_write = stderr_write
          __stream_flush = None
  
      from ..version import __version__
  
      msg = "ClearML v{} - Starting Trace\n\n".format(__version__)
      # print to actual stderr
      stderr_write(msg)
      # store to stream
      __stream_write(msg)
      __stream_write(
          "{:9}:{:5}:{:8}: {:14}\n".format(
              "seconds", "pid", "tid", "self"
          )
      )
      __stream_write(
          "{:9}:{:5}:{:8}:{:15}\n".format(
              "-" * 9, "-" * 5, "-" * 8, "-" * 15
          )
      )
      __trace_start = time.time()
      _patch_module(
          "clearml",
          exclude_prefixes=exclude_prefixes or [],
          only_prefix=only_prefix or [],
      )
  
file_path: clearml/clearml/debugging/trace.py
imports: import os
  import sys
  import threading
  import inspect
  import time
  import zipfile
label_desc: Use image node_id 9 for calling a global function with example usage: trace_trains(stream, level, exclude_prefixes, only_prefix) without return types