code: def _flatten_codebooks(arr, offset_size):
      assert len(arr.shape) == 2
      arr = arr.copy()
      if offset_size is not None:
          for n in range(1, arr.shape[0]):
              arr[n, :] += offset_size * n
      flat_arr = arr.ravel("F")
      return flat_arr
  
imports: import logging
  import os
  import re
  from glob import glob
  from typing import Dict, List
  import librosa
  import numpy
  import torch
  import torchaudio
  import tqdm
  from encodec.utils import convert_audio
  from scipy.special import softmax
  from torch.nn import functional
  from TTS.tts.layers.bark.hubert.hubert_manager import HubertManager
  from TTS.tts.layers.bark.hubert.kmeans_hubert import CustomHubert
  from TTS.tts.layers.bark.hubert.tokenizer import HubertTokenizer
  from TTS.tts.layers.bark.load_model import clear_cuda_cache, inference_mode
label_desc: Use image node_id 12 for calling a global function with example usage: _flatten_codebooks(arr, offset_size) and returns: flat_arr