code: def _cleanup_tickets_with_terminal_states():
      files = _list_tickets()
      build_ids = []
      for file in files:
          _, build_id, _ = _build_info_from_file(file)
          build_ids.append(build_id)
  
      client = boto3.client("codebuild")
      response = client.batch_get_builds(ids=build_ids)
  
      for file, build_details in zip(files, response["builds"]):
          _, _build_id_from_file, _ = _build_info_from_file(file)
          build_status = build_details["buildStatus"]
  
          if (
              build_status != "IN_PROGRESS"
              and _build_id_from_file == build_details["id"]
          ):
              print(
                  "Build %s in terminal state: %s, deleting lock"
                  % (_build_id_from_file, build_status)
              )
              file.delete()
  
file_path: sagemaker-python-sdk/ci-scripts/queue_build.py
imports: from __future__ import absolute_import
  import os
  import re
  import time
  import boto3
label_desc: Use image node_id 5 for calling a global function with example usage: _cleanup_tickets_with_terminal_states() without return types