code: def _shape_spectrum_output(spectrums, data_format):
      """Shape batch spectrograms into the right format.
  
      Args:
          spectrums (`Tensor`): result of tf.signal.stft or similar, i.e., (..., time, freq).
          data_format (`str`): 'channels_first' or 'channels_last'
  
      Returns:
          spectrums (`Tensor`): a transposed version of input `spectrums`
  
      """
      if data_format == _CH_FIRST_STR:
          pass  # probably it's already (batch, channel, time, freq)
      else:
          spectrums = tf.transpose(
              spectrums, perm=(0, 2, 3, 1)
          )  # (batch, time, freq, channel)
      return spectrums
  
imports: import tensorflow
  from tensorflow.keras import backend
  from tensorflow.keras.layers import Layer
  from .None import backend
  from .backend import _CH_FIRST_STR, _CH_LAST_STR, _CH_DEFAULT_STR
  from .tflite_compatible_stft import atan2_tflite
label_desc: Use image node_id 1 for calling a global function with example usage: _shape_spectrum_output(spectrums, data_format) and returns: spectrums