code: def read_bytearray8(f):
      r"""
      >>> import io, struct, sys
      >>> read_bytearray8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
      bytearray(b'')
      >>> read_bytearray8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
      bytearray(b'abc')
      >>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
      >>> read_bytearray8(io.BytesIO(bigsize8 + b"abcdef"))  #doctest: +ELLIPSIS
      Traceback (most recent call last):
      ...
      ValueError: expected ... bytes in a bytearray8, but only 6 remain
      """
  
      n = read_uint8(f)
      assert n >= 0
      if n > sys.maxsize:
          raise ValueError(
              "bytearray8 byte count > sys.maxsize: %d" % n
          )
      data = f.read(n)
      if len(data) == n:
          return bytearray(data)
      raise ValueError(
          "expected %d bytes in a bytearray8, but only %d remain"
          % (n, len(data))
      )
  
imports: import codecs
  import io
  import pickle
  import re
  import sys
  from struct import unpack
  from pickle import decode_long
label_desc: Use image node_id 14 for calling a global function with example usage: read_bytearray8(f) and returns: bytearray