code: def _service_account_entry(
      user_id: int,
      user_group: int,
      credentials_path: str,
      docker_credentials_dir: str,
      write_adc_placeholder: bool,
  ):
      """Generates the Dockerfile entries required to transfer a set of Cloud service
      account credentials into the Docker container.
  
      NOTE the write_adc_placeholder variable is here because the "ctpu" script
      that we use to interact with TPUs has a bug in it, as of 1/21/2020, where the
      script will fail if the application_default_credentials.json file isn't
      present, EVEN THOUGH it properly uses the service account credentials
      registered with gcloud instead of ADC creds.
  
      If a service account is present, we write a placeholder string to get past
      this problem. This shouldn't matter for anyone else since adc isn't used if a
      service account is present.
  
      """
      container_creds = f"{docker_credentials_dir}/credentials.json"
      ret = f"""
  {copy_command(user_id, user_group, credentials_path, container_creds)}
  
  # Use the credentials file to activate gcloud, gsutil inside the container.
  RUN gcloud auth activate-service-account --key-file={container_creds} && \
    git config --global credential.'https://source.developers.google.com'.helper gcloud.sh
  
  ENV GOOGLE_APPLICATION_CREDENTIALS={container_creds}
  """
  
      if write_adc_placeholder:
          ret += f"""
  RUN echo "placeholder" >> {adc_location(container_home())}
  """
  
      return ret
  
imports: from __future__ import absolute_import, division, print_function
  import json
  import os
  import subprocess
  import tempfile
  from enum import Enum
  from pathlib import Path
  from typing import Any, Dict, List, NamedTuple, NewType, Optional, Union
  from absl import logging
  from blessings import Terminal
  import caliban.config
  import caliban.util
  import caliban.util.fs
  import caliban.util.metrics
label_desc: Use image node_id 16 for calling a global function with example usage: _service_account_entry(user_id, user_group, credentials_path, docker_credentials_dir, write_adc_placeholder) and returns: ret