code: def update(filename, py38_dir, py311_dir):
      def read_test_results(directory):
          xmls = open_test_results(directory)
          testcases = get_testcases(xmls)
          unexpected_successes = {
              key(test): test
              for test in testcases
              if is_unexpected_success(test)
          }
          failures = {
              key(test): test for test in testcases if is_failure(test)
          }
          return unexpected_successes, failures
  
      py38_unexpected_successes, py38_failures = read_test_results(
          py38_dir
      )
      py311_unexpected_successes, py311_failures = read_test_results(
          py311_dir
      )
  
      unexpected_successes = {
          **py38_unexpected_successes,
          **py311_unexpected_successes,
      }
      _, skips = get_intersection_and_outside(
          py38_unexpected_successes, py311_unexpected_successes
      )
      xfails, more_skips = get_intersection_and_outside(
          py38_failures, py311_failures
      )
      all_skips = {**skips, **more_skips}
      print(
          f"Discovered {len(unexpected_successes)} new unexpected successes, "
          f"{len(xfails)} new xfails, {len(all_skips)} new skips"
      )
      return patch_file(
          filename, unexpected_successes, xfails, all_skips
      )
  
imports: import argparse
  from common import get_testcases, is_failure, is_unexpected_success, key, open_test_results
label_desc: Use image node_id 3 for calling a global function with example usage: update(filename, py38_dir, py311_dir) and returns: patch_file, unexpected_successes,  failures