code: def writeToDelimitedString(obj, stream=None):
      """
      Stanford CoreNLP uses the Java "writeDelimitedTo" function, which
      writes the size (and offset) of the buffer before writing the object.
      This function handles parsing this message starting from offset 0.
  
      @returns how many bytes of @buf were consumed.
      """
      if stream is None:
          stream = BytesIO()
  
      _EncodeVarint(stream.write, obj.ByteSize(), True)
      stream.write(obj.SerializeToString())
      return stream
  
file_path: stanza/stanza/protobuf/__init__.py
imports: from __future__ import absolute_import
  from io import BytesIO
  import warnings
  from google.protobuf.internal.encoder import _EncodeVarint
  from google.protobuf.internal.decoder import _DecodeVarint
  from google.protobuf.message import DecodeError
  from .CoreNLP_pb2 import *
label_desc: Use image node_id 2 for calling a global function with example usage: writeToDelimitedString(obj, stream) and returns: stream