code: def on_gcp():
      """Detect whether the current running environment is on GCP."""
      gce_metadata_endpoint = "http://" + os.environ.get(
          _GCE_METADATA_URL_ENV_VARIABLE, "metadata.google.internal"
      )
  
      try:
          # Timeout in 5 seconds, in case the test environment has connectivity issue.
          # There is not default timeout, which means it might block forever.
          response = requests.get(
              "%s/computeMetadata/v1/%s"
              % (gce_metadata_endpoint, "instance/hostname"),
              headers=GCP_METADATA_HEADER,
              timeout=5,
          )
          return response.status_code == 200
      except requests.exceptions.RequestException:
          return False
  
file_path: tensorflow/tensorflow/python/distribute/failure_handling/failure_handling_util.py
imports: import enum
  import os
  import sys
  import requests
  from six.moves.urllib import request
  from tensorflow.python.eager import context
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 5 for calling a global function with example usage: on_gcp() and returns: unknown, False