code: def calculate(
      file_list: List[str],
      gt_file_list: List[str],
      args: argparse.Namespace,
      semitone_acc_dict: Dict[str, float],
  ):
      """Calculate semitone ACC."""
      for i, gen_path in enumerate(file_list):
          corresponding_list = list(
              filter(
                  lambda gt_path: _get_basename(gt_path) in gen_path,
                  gt_file_list,
              )
          )
          assert len(corresponding_list) == 1
          gt_path = corresponding_list[0]
          gt_basename = _get_basename(gt_path)
  
          # load wav file as int16
          gen_x, gen_fs = sf.read(gen_path, dtype="int16")
          gt_x, gt_fs = sf.read(gt_path, dtype="int16")
  
          fs = gen_fs
          if gen_fs != gt_fs:
              gt_x = librosa.resample(
                  gt_x.astype(np.float), gt_fs, gen_fs
              )
  
          # extract ground truth and converted features
          gen_mcep, gen_f0 = world_extract(
              x=gen_x,
              fs=fs,
              f0min=args.f0min,
              f0max=args.f0max,
              n_fft=args.n_fft,
              n_shift=args.n_shift,
              mcep_dim=args.mcep_dim,
              mcep_alpha=args.mcep_alpha,
          )
          gt_mcep, gt_f0 = world_extract(
              x=gt_x,
              fs=fs,
              f0min=args.f0min,
              f0max=args.f0max,
              n_fft=args.n_fft,
              n_shift=args.n_shift,
              mcep_dim=args.mcep_dim,
              mcep_alpha=args.mcep_alpha,
          )
  
          # DTW
          _, path = fastdtw(
              gen_mcep, gt_mcep, dist=spatial.distance.euclidean
          )
          twf = np.array(path).T
          gen_f0_dtw = gen_f0[twf[0]]
          gt_f0_dtw = gt_f0[twf[1]]
  
          # Semitone ACC
          semitone_GT = np.array(
              [_Hz2Semitone(_f0) for _f0 in gt_f0_dtw]
          )
          semitone_predict = np.array(
              [_Hz2Semitone(_f0) for _f0 in gen_f0_dtw]
          )
          semitone_ACC = float(
              (semitone_GT == semitone_predict).sum()
          ) / len(semitone_GT)
          semitone_acc_dict[gt_basename] = semitone_ACC
  
imports: import argparse
  import fnmatch
  import logging
  import multiprocessing
  import os
  from math import log2, pow
  from typing import Dict, List, Tuple
  import librosa
  import numpy
  import pysptk
  import pyworld
  import soundfile
  from fastdtw import fastdtw
  from scipy import spatial
label_desc: Use image node_id 6 for calling a global function with example usage: calculate(file_list, gt_file_list, args, semitone_acc_dict) without return types