code: def write_blockdata(self, obj, parent=None):
          
          if type(obj) is str:
              # Latin-1: keep bytes as is
              obj = to_bytes(obj, "latin-1")
  
          length = len(obj)
          if length <= 256:
              # Small block data
              # TC_BLOCKDATA (unsigned byte)<size> (byte)[size]
              self._writeStruct(">B", 1, (self.TC_BLOCKDATA,))
              self._writeStruct(">B", 1, (length,))
          else:
              # Large block data
              # TC_BLOCKDATALONG (unsigned int)<size> (byte)[size]
              self._writeStruct(">B", 1, (self.TC_BLOCKDATALONG,))
              self._writeStruct(">I", 1, (length,))
  
          self.object_stream.write(obj)
docs: Appends a block of data to the serialization stream
  
          :param obj: String form of the data block