code: def _maybe_convert_to_wav_bytes(
      data: MediaData, sample_rate: Optional[int]
  ) -> MediaData:
      """Convert data to wav bytes if the data type is numpy array."""
      if (
          type_util.is_type(data, "numpy.ndarray")
          and sample_rate is not None
      ):
          data = _make_wav(cast("npt.NDArray[Any]", data), sample_rate)
      return data
  
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 6 for calling a global function with example usage: _maybe_convert_to_wav_bytes(data, sample_rate) and returns: data