code: def _filter_suite(suite, pred):
      """Recursively filter test cases in a suite based on a predicate."""
      newtests = []
      for test in suite._tests:
          if isinstance(test, unittest.TestSuite):
              _filter_suite(test, pred)
              newtests.append(test)
          else:
              if pred(test):
                  newtests.append(test)
      suite._tests = newtests
  
imports: import faulthandler
  import gc
  import importlib
  import io
  import sys
  import time
  import traceback
  import unittest
  from test import support
  from test.support import threading_helper
  from .filter import match_test
  from .result import State, TestResult, TestStats
  from .runtests import RunTests
  from .save_env import saved_test_environment
  from .setup import setup_tests
  from .testresult import get_test_runner
  from .utils import TestName, clear_caches, remove_testfn, abs_module_name, print_warning
label_desc: Use image node_id 2 for calling a global function with example usage: _filter_suite(suite, pred) without return types