code: def mock_k8s(mocker):
      env = {}
      token_path = "/var/run/secrets/kubernetes.io/serviceaccount/token"
      #  crt_path = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
      orig_exist = os.path.exists
  
      def exists(path):
          return True if path in token_path else orig_exist(path)
  
      def magic(path, *args, **kwargs):
          if path == token_path:
              return io.StringIO("token")
  
      mocker.patch("wandb.util.open", magic, create=True)
      mocker.patch("wandb.util.os.path.exists", exists)
      env["KUBERNETES_SERVICE_HOST"] = "k8s"
      env["KUBERNETES_PORT_443_TCP_PORT"] = "123"
      env["HOSTNAME"] = "test"
      return env
  
file_path: wandb/tests/pytest_tests/unit_tests_old/utils/utils.py
imports: import io
  import os
  import shutil
  import socket
  from typing import Union
label_desc: Use image node_id 13 for calling a global function with example usage: mock_k8s(mocker) and returns: env, unknown, io