code: def find_block_ending(lines, start_idx, indent_level):
      end_idx = start_idx
      for idx, line in enumerate(lines[start_idx:]):
          indent = len(line) - len(line.lstrip())
          if (
              idx == 0
              or indent > indent_level
              or (indent == indent_level and line.strip() == ")")
          ):
              end_idx = start_idx + idx
          elif idx > 0 and indent <= indent_level:
              # Outside the definition block of `pipeline_model_mapping`
              break
  
      return end_idx
  
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 8 for calling a global function with example usage: find_block_ending(lines, start_idx, indent_level) and returns: end_idx