code: def _ausave_before(path, audio_arr, channel_first):
      if not isinstance(audio_arr, np.ndarray):
          raise ValueError(
              "the input audio_arr for ausave must be numpy.ndarray."
          )
  
      if len(audio_arr.shape) != 2:
          raise ValueError("size must be (samples, channels) liked")
  
      filepath = path if isinstance(path, str) else path.name
  
      npath = os.path.abspath(filepath)
      dir_name = os.path.dirname(npath)
      os.makedirs(dir_name, exist_ok=True)
  
      ext = os.path.splitext(filepath)[-1]
      if ext not in [".wav"]:
          raise ValueError("only support save as .wav format for now.")
  
      if audio_arr.dtype.itemsize > 4:
          raise ValueError(
              "audio_arr's dtype.itemsize should not greater than 4"
          )
  
      if channel_first and len(audio_arr.shape) == 2:
          audio_arr = audio_arr.transpose((1, 0))
  
      return audio_arr
  
file_path: nnabla/python/src/nnabla/utils/audio_utils/common.py
imports: from __future__ import division, absolute_import
  import os
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: _ausave_before(path, audio_arr, channel_first) and returns: audio_arr