code: def _GceMetadataRequest(relative_url, use_metadata_ip=False):
      
      if use_metadata_ip:
          base_url = os.environ.get('GCE_METADATA_IP', '169.254.169.254')
      else:
          base_url = os.environ.get(
              'GCE_METADATA_ROOT', 'metadata.google.internal')
      url = 'http://' + base_url + '/computeMetadata/v1/' + relative_url
      # Extra header requirement can be found here:
      # https://developers.google.com/compute/docs/metadata
      headers = {'Metadata-Flavor': 'Google'}
      request = urllib.request.Request(url, headers=headers)
      opener = urllib.request.build_opener(urllib.request.ProxyHandler({}))
      try:
          response = opener.open(request)
      except urllib.error.URLError as e:
          raise exceptions.CommunicationError(
              'Could not reach metadata service: %s' % e.reason)
      return response
docs: Request the given url from the GCE metadata service.