'Write a datagram into this tunnel.
@param datagram: The datagram to write.
@type datagram: L{bytes}
@raise IOError: Any of the usual I/O problems can result in this
exception being raised with some particular error number set.
@return: The number of bytes of the datagram which were written.
@rtype: L{int}'

def write(self, datagram):

    if self.pendingSignals:
        self.pendingSignals.popleft()
        raise IOError(EINTR, 'Interrupted    system    call')
    if (len(datagram) > self.SEND_BUFFER_SIZE):
        raise IOError(ENOBUFS, 'No    buffer    space    available')
    self.writeBuffer.append(datagram)
    return len(datagram)
