code: def compute_pitch_stats(records):
      def _is_valid_pitch(pitch_mean, pitch_std):
          c1 = pitch_mean > 0 and pitch_mean < 1000
          c2 = pitch_std > 0 and pitch_std < 1000
          return c1 and c2
  
      speaker_wise_pitch_contours = {}
      for item in records:
          wav_id = item["wav_id"]
          speaker = item["speaker"]
          sup_data_dir = item["sup_data_dir"]
          pitch_contour_fn = f"pitch_contour_{wav_id}.pt"
          pitch_contour_fp = os.path.join(
              sup_data_dir, pitch_contour_fn
          )
          if speaker not in speaker_wise_pitch_contours:
              speaker_wise_pitch_contours[speaker] = []
          speaker_wise_pitch_contours[speaker].append(pitch_contour_fp)
  
      speaker_pitch_stats = {}
      for speaker in speaker_wise_pitch_contours:
          non_zero_pc = []
          for pitch_contour_fp in speaker_wise_pitch_contours[speaker][
              :50
          ]:
              pitch_contour = torch.load(pitch_contour_fp)
              pitch_contour_nonzero = pitch_contour[pitch_contour != 0]
              if len(pitch_contour_nonzero) > 0:
                  non_zero_pc.append(pitch_contour_nonzero)
  
          if len(non_zero_pc) > 0:
              non_zero_pc = torch.cat(non_zero_pc)
              pitch_mean = non_zero_pc.mean().item()
              pitch_std = non_zero_pc.std().item()
              valid = True
  
              if not _is_valid_pitch(pitch_mean, pitch_std):
                  logging.warning("invalid pitch: {}".format(speaker))
                  pitch_mean = 212.0
                  pitch_std = 70.0
                  valid = "False"
          else:
              logging.warning(
                  "could not find pitch contour for speaker {}".format(
                      speaker
                  )
              )
              valid = "False"
              pitch_mean = 212.0
              pitch_std = 70.0
  
          speaker_pitch_stats[speaker] = {
              "pitch_mean": pitch_mean,
              "pitch_std": pitch_std,
              "valid": valid,
          }
  
      with open(
          os.path.join(sup_data_dir, "speaker_pitch_stats.json"), "w"
      ) as f:
          json.dump(speaker_pitch_stats, f)
  
imports: import argparse
  import json
  import os
  import time
  from multiprocessing import Pool
  from pathlib import Path
  import hydra.utils
  import librosa
  import numpy
  import torch
  from omegaconf import open_dict
  from tqdm import tqdm
  from nemo.collections.asr.parts.preprocessing.segment import AudioSegment
  from nemo.collections.tts.models import ssl_tts
  from nemo.collections.tts.parts.utils.tts_dataset_utils import get_base_dir
  from nemo.core.classes import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 6 for calling a global function with example usage: compute_pitch_stats(records) and returns: unknown