code: def get_problem_stack(backtrace):
      stack = []
      found_thread1 = False
      regex = re.compile(r"[Tt]hread (\d+)")
  
      for line in backtrace.split("\n"):
          match = regex.search(line)
          if match:
              if found_thread1:
                  break
              if int(match.group(1)) == 1:
                  found_thread1 = True
          if found_thread1:
              stack.append(line)
  
      if not stack:
          return backtrace
      return "\n".join(stack)
  
file_path: catboost/library/python/cores/__init__.py
imports: import os
  import re
  import glob
  import socket
  import logging
  import platform
  import subprocess
  import six
  from library.python.reservoir_sampling import reservoir_sampling
label_desc: Use image node_id 4 for calling a global function with example usage: get_problem_stack(backtrace) and returns: str, backtrace