length = len(data) # - if encoded as a list instead, serialize as bytes instead of string if type(data) in [list, tuple]: buff.write(struct.pack('