code: def get(request, path, root=_METADATA_ROOT, recursive=False):
      
      base_url = urlparse.urljoin(root, path)
      query_params = {}
  
      if recursive:
          query_params['recursive'] = 'true'
  
      url = _helpers.update_query(base_url, query_params)
  
      response = request(url=url, method='GET', headers=_METADATA_HEADERS)
  
      if response.status == http_client.OK:
          content = _helpers.from_bytes(response.data)
          if response.headers['content-type'] == 'application/json':
              try:
                  return json.loads(content)
              except ValueError as caught_exc:
                  new_exc = exceptions.TransportError(
                      'Received invalid JSON from the Google Compute Engine'
                      'metadata service: {:.20}'.format(content))
                  six.raise_from(new_exc, caught_exc)
          else:
              return content
      else:
          raise exceptions.TransportError(
              'Failed to retrieve {} from the Google Compute Engine'
              'metadata service. Status: {} Response:\n{}'.format(
                  url, response.status, response.data), response)
docs: Fetch a resource from the metadata server.
  
      Args:
          request (google.auth.transport.Request): A callable used to make
              HTTP requests.
          path (str): The resource to retrieve. For example,
              ``'instance/service-accounts/default'``.
          root (str): The full path to the metadata server root.
          recursive (bool): Whether to do a recursive query of metadata. See
              https://cloud.google.com/compute/docs/metadata#aggcontents for more
              details.
  
      Returns:
          Union[Mapping, str]: If the metadata server returns JSON, a mapping of
              the decoded JSON is return. Otherwise, the response content is
              returned as a string.
  
      Raises:
          google.auth.exceptions.TransportError: if an error occurred while
              retrieving metadata.