def _detect_gce_environment():
 http = transport.get_http_object(timeout=GCE_METADATA_TIMEOUT)
 try:
  (response, _) = transport.request(http, _GCE_METADATA_URI, headers=_GCE_HEADERS)
  return ((response.status == http_client.OK) and (response.get(_METADATA_FLAVOR_HEADER) == _DESIRED_METADATA_FLAVOR))
 except socket.error:
  logger.info('Timeout attempting to reach GCE metadata service.')
  return False

def _detect_gce_environment ( ) : http = transport . get_http_object ( timeout = GCE_METADATA_TIMEOUT ) try : ( response , _ ) = transport . request ( http , _GCE_METADATA_URI , headers = _GCE_HEADERS ) return ( ( response . status == http_client . OK ) and ( response . get ( _METADATA_FLAVOR_HEADER ) == _DESIRED_METADATA_FLAVOR ) ) except socket . error : logger . info ( 'Timeout attempting to reach GCE metadata service.' ) return False
determine if the current environment is compute engine .