code: def mock_service_client(self, tpu_map=None):
      if tpu_map is None:
          tpu_map = {}
  
      mock_locations = mock.MagicMock()
      mock_locations.nodes.return_value = MockNodeClass(tpu_map)
  
      mock_project = mock.MagicMock()
      mock_project.locations.return_value = mock_locations
  
      mock_client = mock.MagicMock()
      mock_client.projects.return_value = mock_project
  
      return mock_client
  
imports: import os
  import six
  from six.moves.urllib.error import URLError
  from tensorflow.core.protobuf.tpu import topology_pb2
  from tensorflow.python.client import session
  from tensorflow.python.distribute.cluster_resolver.tpu import tpu_cluster_resolver
  from tensorflow.python.eager import context
  from tensorflow.python.framework import config
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.training import server_lib
  from tensorflow.python.util import compat
label_desc: Use image node_id 2 for calling the TPUClusterResolverTest obj's underlying member method code with example usage: obj.mock_service_client(tpu_map) and returns: mock_client