def retrieve_metadata_server(metadata_key):
    """Retrieve the metadata key in the metadata server.

    See: https://cloud.google.com/compute/docs/storing-retrieving-metadata

    :type metadata_key: str
    :param metadata_key: Key of the metadata which will form the url. You can
                         also supply query parameters after the metadata key.
                         e.g. "tags?alt=json"

    :rtype: str
    :returns: The value of the metadata key returned by the metadata server.
    """
    url = METADATA_URL + metadata_key

    try:
        response = requests.get(url, headers=METADATA_HEADERS)

        if response.status_code == requests.codes.ok:
            return response.text

    except requests.exceptions.RequestException:
        # Ignore the exception, connection failed means the attribute does not
        # exist in the metadata server.
        pass

    return None
Retrieve the metadata key in the metadata server.

    See: https://cloud.google.com/compute/docs/storing-retrieving-metadata

    :type metadata_key: str
    :param metadata_key: Key of the metadata which will form the url. You can
                         also supply query parameters after the metadata key.
                         e.g. "tags?alt=json"

    :rtype: str
    :returns: The value of the metadata key returned by the metadata server.