code: def find_test_class(test_file):
      """Find a test class in `test_file` to which we will add `pipeline_model_mapping`."""
      test_classes = [
          x
          for x in get_test_classes(test_file)
          if is_valid_test_class(x)
      ]
  
      target_test_class = None
      for test_class in test_classes:
          # If a test class has defined `pipeline_model_mapping`, let's take it
          if (
              getattr(test_class, "pipeline_model_mapping", None)
              is not None
          ):
              target_test_class = test_class
              break
      # Take the test class with the shortest name (just a heuristic)
      if target_test_class is None and len(test_classes) > 0:
          target_test_class = sorted(
              test_classes, key=lambda x: (len(x.__name__), x.__name__)
          )[0]
  
      return target_test_class
  
file_path: transformers/utils/add_pipeline_model_mapping_to_test.py
imports: import argparse
  import glob
  import inspect
  import os
  import re
  import unittest
  from get_test_info import get_test_classes
  from tests.test_pipeline_mixin import pipeline_test_mapping
label_desc: Use image node_id 7 for calling a global function with example usage: find_test_class(test_file) and returns: target_test_class