code: def convert_object_to_bytearray(model_object, extra_buffer=b""):
      """Converts a tflite model from an object to a immutable bytearray."""
      # Initial size of the buffer, which will grow automatically if needed
      builder = flatbuffers.Builder(1024)
      model_offset = model_object.Pack(builder)
      builder.Finish(
          model_offset, file_identifier=_TFLITE_FILE_IDENTIFIER
      )
      model_bytearray = bytes(builder.Output())
      model_bytearray = model_bytearray + extra_buffer
      return model_bytearray
  
imports: import copy
  import random
  import re
  import struct
  import sys
  import flatbuffers
  from tensorflow.lite.python import schema_py_generated
  from tensorflow.lite.python import schema_util
  from tensorflow.python.platform import gfile
label_desc: Use image node_id 4 for calling a global function with example usage: convert_object_to_bytearray(model_object, extra_buffer) and returns: model_bytearray