def truncate(self, size=DEFAULT):
        if self.mode in READ_MODES:
            raise IOError('Bad file descriptor')
        if size is not DEFAULT:
            size = self._check_int_argument(size)
            if size < 0:
                raise IOError('Invalid argument')
        else:
            size = self._position
        data = self._data[:size]
        self._data = data + (size - len(data)) * '\x00'
        self.flush()
Verify that IOCP socket-representing classes implement IReadWriteHandle
dataset/ETHPy150Open mockfs/mockfs/mockfs/storage.py/file.truncate--crossover with--dataset/ETHPy150Open twisted/twisted/twisted/internet/test/test_iocp.py/IOCPReactorTests.test_reactorInterfaces