code: def clean_up_failed_test_dict(oldest_time_allowed):
      # read in data from dictionary file
      global g_failed_tests_info_dict
      if (
          os.path.isfile(g_failed_tests_dict)
          and os.path.getsize(g_failed_tests_dict) > 10
      ):
          try:
              g_failed_tests_info_dict = json.load(
                  open(g_failed_tests_dict, "r")
              )
              test_index = 0
              while test_index < len(
                  g_failed_tests_info_dict["TestName"]
              ):
                  test_dicts = g_failed_tests_info_dict["TestInfo"][
                      test_index
                  ]  # a list of dictionary
  
                  dict_index = 0
                  while (len(test_dicts["Timestamp"]) > 0) and (
                      dict_index < len(test_dicts["Timestamp"])
                  ):
                      if (
                          test_dicts["Timestamp"][dict_index]
                          < oldest_time_allowed
                      ):
                          del test_dicts["JenkinsJobName"][dict_index]
                          del test_dicts["BuildID"][dict_index]
                          del test_dicts["Timestamp"][dict_index]
                          del test_dicts["GitHash"][dict_index]
                          del test_dicts["TestCategory"][dict_index]
                          del test_dicts["NodeName"][dict_index]
                          test_dicts["FailureCount"] -= 1
                      else:
                          dict_index = dict_index + 1
  
                  if (
                      test_dicts["FailureCount"] <= 0
                  ):  # remove test name with 0 counts of failure count
                      del g_failed_tests_info_dict["Testname"][
                          test_index
                      ]
                      del g_failed_tests_info_dict["TestInfo"][
                          test_index
                      ]
                  else:
                      test_index = test_index + 1
  
              json.dump(
                  g_failed_tests_info_dict,
                  open(g_failed_tests_dict, "w"),
              )
          except:
              pass
  
file_path: h2o-3/scripts/scrapeForIntermittents.py
imports: import sys
  import os
  import json
  import subprocess
  import time
  import datetime
  from pytz import timezone
  from dateutil import parser
label_desc: Use image node_id 9 for calling a global function with example usage: clean_up_failed_test_dict(oldest_time_allowed) without return types