code: def _mock_kubernetes_client(ret):
      mock_client = mock.MagicMock()
      mock_client.list_pod_for_all_namespaces.side_effect = (
          lambda *args, **kwargs: ret[kwargs["label_selector"]]
      )
      return mock_client
  
file_path: tensorflow/tensorflow/python/distribute/cluster_resolver/kubernetes_cluster_resolver_test.py
imports: from tensorflow.python.distribute.cluster_resolver.kubernetes_cluster_resolver import KubernetesClusterResolver
  from tensorflow.python.platform import test
  from tensorflow.python.training import server_lib
label_desc: Use image node_id 1 for calling a global function with example usage: _mock_kubernetes_client(ret) and returns: mock_client