code: def _write_audio_file(np_audio, path, file_format):
      """Creates a random audio file with the given file format."""
      dtype = np_audio.dtype
  
      if (file_format == "flac" and dtype not in [np.int16]) or (
          file_format == "wav" and dtype not in [np.int16, np.int32]
      ):
          raise ValueError(
              f'Can\'t save audio in "{file_format.upper()}" format with dtype '
              f"`{np_audio.dtype}`."
          )
  
      data = array.array(np.sctype2char(dtype), np_audio.reshape((-1,)))
      sample_width = np.dtype(dtype).alignment
      num_channels = (
          np_audio.shape[1] if len(np_audio.shape) == 2 else 1
      )
  
      pydub.AudioSegment(
          data=data,
          sample_width=sample_width,
          channels=num_channels,
          frame_rate=1,
      ).export(path, format=file_format)
  
imports: import array
  import pathlib
  import tempfile
  from absl.testing import parameterized
  import numpy
  import pydub
  import tensorflow
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import features
label_desc: Use image node_id 3 for calling a global function with example usage: _write_audio_file(np_audio, path, file_format) without return types