code: def set_validate_gcp_credentials(
      configs: Optional[Dict] = None, keypath: Optional[str] = None
  ) -> None:
      """Sets and validates GCP Credentials.
      - If det_configs are available, then uses that to set credentials
      - Else if only keypath is available, then uses it set credentials
      - If none are available/provided, validates if credentials are set and valid
      """
      if keypath:
          os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = keypath
      if configs:
          vars_file_path = get_terraform_vars_file_path(configs)
          # Try to load google credentials from terraform vars when present.
          if os.path.exists(vars_file_path):
              tf_vars = terraform_read_variables(vars_file_path)
              set_gcp_credentials_env(tf_vars)
  
      try:
          googleapiclient.discovery.build("compute", "v1")
      except DefaultCredentialsError as exc:
          err = (
              colored("Unable to locate GCP credentials.", "red")
              + " Please set "
              + colored("GOOGLE_APPLICATION_CREDENTIALS", "yellow")
              + " or explicitly create credentials "
              + "and re-run the application. "
              + "For more information, please see "
              + "https://docs.determined.ai/latest/sysadmin-deploy-on-gcp/install-gcp.html#credential"
              + "s and "
              + "https://cloud.google.com/docs/authentication/getting-started"
          )
          raise CliError(err) from exc
  
imports: import json
  import os
  import shutil
  import subprocess
  import sys
  import time
  from pathlib import Path
  from typing import Any, Dict, List, Optional
  import googleapiclient.discovery
  from google.auth.exceptions import DefaultCredentialsError
  from google.cloud import storage
  from googleapiclient.errors import HttpError
  from tabulate import tabulate
  from termcolor import colored
  from determined import util
  from determined.cli import render
  from determined.cli.errors import CliError
  from determined.common import util
  from determined.deploy import healthcheck
  from .preflight import check_quota
label_desc: Use image node_id 21 for calling a global function with example usage: set_validate_gcp_credentials(configs, keypath) without return types