'Writes data to the contained stream.
@param data string to send, or 0
@return None'

def write(self, data, pack=struct.pack, eol=struct.pack('!b', 0)):

    send = self.send
    if (data == 0):
        send(eol)
    else:
        for char in data:
            if (sys.version_info[0] > 2):
                char = char.encode('utf-8')
            send(pack('!c', char))
