def mock_is_master(self, host):
        min_wire_version, max_wire_version = self.mock_wire_versions.get(
            host,
            (common.MIN_WIRE_VERSION, common.MAX_WIRE_VERSION))

        max_write_batch_size = self.mock_max_write_batch_sizes.get(
            host, common.MAX_WRITE_BATCH_SIZE)

        rtt = self.mock_rtts.get(host, 0)

        # host is like 'a:1'.
        if host in self.mock_down_hosts:
            raise NetworkTimeout('mock timeout')

        elif host in self.mock_standalones:
            response = {
                'ok': 1,
                'ismaster': True,
                'minWireVersion': min_wire_version,
                'maxWireVersion': max_wire_version,
                'maxWriteBatchSize': max_write_batch_size}
        elif host in self.mock_members:
            ismaster = (host == self.mock_primary)

            # Simulate a replica set member.
            response = {
                'ok': 1,
                'ismaster': ismaster,
                'secondary': not ismaster,
                'setName': 'rs',
                'hosts': self.mock_ismaster_hosts,
                'minWireVersion': min_wire_version,
                'maxWireVersion': max_wire_version,
                'maxWriteBatchSize': max_write_batch_size}

            if self.mock_primary:
                response['primary'] = self.mock_primary
        elif host in self.mock_mongoses:
            response = {
                'ok': 1,
                'ismaster': True,
                'minWireVersion': min_wire_version,
                'maxWireVersion': max_wire_version,
                'msg': 'isdbgrid',
                'maxWriteBatchSize': max_write_batch_size}
        else:
            # In test_internal_ips(), we try to connect to a host listed
            # in ismaster['hosts'] but not publicly accessible.
            raise AutoReconnect('Unknown host: %s' % host)

        return response, rtt
Write the given text to our wrapped stream, stripping any ANSI
dataset/ETHPy150Open mongodb/mongo-python-driver/test/pymongo_mocks.py/MockClient.mock_is_master--crossover with--dataset/ETHPy150Open floooh/fips/colorama/ansitowin32.py/AnsiToWin32.write_and_convert