code: def _make_wav(data: "npt.NDArray[Any]", sample_rate: int) -> bytes:
      """
      Transform a numpy array to a PCM bytestring
      We use code from IPython display module to convert numpy array to wave bytes
      https://github.com/ipython/ipython/blob/1015c392f3d50cf4ff3e9f29beede8c1abfdcb2a/IPython/lib/display.py#L146
      """
      # we import wave here locally to import it only when needed (when numpy array given
      # to st.audio data)
      import wave
  
      scaled, nchan = _validate_and_normalize(data)
  
      with io.BytesIO() as fp, wave.open(fp, mode="wb") as waveobj:
          waveobj.setnchannels(nchan)
          waveobj.setframerate(sample_rate)
          waveobj.setsampwidth(2)
          waveobj.setcomptype("NONE", "NONE")
          waveobj.writeframes(scaled)
          return fp.getvalue()
  
imports: import io
  import re
  from typing import TYPE_CHECKING, Optional, Tuple, Union, cast
  from typing_extensions import Final, TypeAlias
  import streamlit
  from streamlit import runtime, type_util
  from streamlit.errors import StreamlitAPIException
  from streamlit.proto.Audio_pb2 import Audio
  from streamlit.proto.Video_pb2 import Video
  from streamlit.runtime import caching
  from streamlit.runtime.metrics_util import gather_metrics
label_desc: Use image node_id 5 for calling a global function with example usage: _make_wav(data, sample_rate) and returns: fp