code: def write_opus(
      opus_file, audio_data, audio_format=DEFAULT_FORMAT, bitrate=None
  ):
      frame_size = get_opus_frame_size(audio_format.rate)
      import opuslib  # pylint: disable=import-outside-toplevel
  
      encoder = opuslib.Encoder(
          audio_format.rate, audio_format.channels, "audio"
      )
      if bitrate is not None:
          encoder.bitrate = bitrate
      chunk_size = (
          frame_size * audio_format.channels * audio_format.width
      )
      opus_file.write(pack_number(len(audio_data), OPUS_PCM_LEN_SIZE))
      opus_file.write(pack_number(audio_format.rate, OPUS_RATE_SIZE))
      opus_file.write(
          pack_number(audio_format.channels, OPUS_CHANNELS_SIZE)
      )
      opus_file.write(pack_number(audio_format.width, OPUS_WIDTH_SIZE))
      for i in range(0, len(audio_data), chunk_size):
          chunk = audio_data[i : i + chunk_size]
          # Preventing non-deterministic encoding results from uninitialized remainder of the encoder buffer
          if len(chunk) < chunk_size:
              chunk = chunk + b"\0" * (chunk_size - len(chunk))
          encoded = encoder.encode(chunk, frame_size)
          opus_file.write(
              pack_number(len(encoded), OPUS_CHUNK_LEN_SIZE)
          )
          opus_file.write(encoded)
  
imports: import collections
  import ctypes
  import io
  import math
  import numpy
  import os
  import pyogg
  import tempfile
  import wave
  from .helpers import LimitingPool
  from collections import namedtuple
  from .io import open_remote, remove_remote, copy_remote, is_remote_path
label_desc: Use image node_id 15 for calling a global function with example usage: write_opus(opus_file, audio_data, audio_format, bitrate) without return types