'Send as much of C{data} as possible.  Also send any pending file
descriptors.'

def writeSomeData(self, data):

    if (len(self._sendmsgQueue) > len(data)):
        return error.FileDescriptorOverrun()
    index = 0
    try:
        while (index < len(self._sendmsgQueue)):
            fd = self._sendmsgQueue[index]
            try:
                untilConcludes(sendmsg.sendmsg, self.socket, data[index:(index + 1)], _ancillaryDescriptor(fd))
            except socket.error as se:
                if (se.args[0] in (EWOULDBLOCK, ENOBUFS)):
                    return index
                else:
                    return main.CONNECTION_LOST
            else:
                index += 1
    finally:
        del self._sendmsgQueue[:index]
    limitedData = lazyByteSlice(data, index)
    result = self._writeSomeDataBase.writeSomeData(self, limitedData)
    try:
        return (index + result)
    except TypeError:
        return result
