code: def default_credentials(
      scopes: Optional[List[str]] = None, *, anonymous_ok: bool = True
  ) -> Union["GoogleCredentials", AnonymousCloudCredentials]:
      credentials_file = first_extant_file(
          os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"),
          f'{os.environ["HOME"]}/.config/gcloud/application_default_credentials.json'
          if "HOME" in os.environ
          else None,
      )
  
      if credentials_file:
          creds = GoogleCredentials.from_file(
              credentials_file, scopes=scopes
          )
          log.info(
              f"using credentials file {credentials_file}: {creds}"
          )
          return creds
  
      log.info("Unable to locate Google Cloud credentials file")
      if GoogleInstanceMetadataCredentials.available():
          log.info(
              "Will attempt to use instance metadata server instead"
          )
          return GoogleInstanceMetadataCredentials(scopes=scopes)
  
      if not anonymous_ok:
          raise ValueError(
              "No valid Google Cloud credentials found. Run `gcloud auth application-default login` or set `GOOGLE_APPLICATION_CREDENTIALS`."
          )
      log.warning(
          "Using anonymous credentials. If accessing private data, "
          "run `gcloud auth application-default login` first to log in."
      )
      return AnonymousCloudCredentials()
  
imports: from typing import Dict, Optional, Union, List, Literal, ClassVar, overload, Tuple
  import os
  import json
  import time
  import logging
  import socket
  from urllib.parse import urlencode
  import jwt
  from hailtop.utils import first_extant_file, retry_transient_errors
  from hailtop import httpx
  from ..common.credentials import AnonymousCloudCredentials, CloudCredentials
label_desc: Use image node_id 7 for calling the GoogleCredentials obj's underlying member method code with example usage: obj.default_credentials(scopes) and returns: AnonymousCloudCredentials, creds, GoogleInstanceMetadataCredentials