def get_latest_reading(client, name):
    """Returns the value and timestamp of the latest reading."""
    query = client.query(kind=name)
    query.order = ["-timestamp"]
    results = list(query.fetch(limit=1))

    if not results:
        return None, None
    result = results[0]
    if "value" not in result:
        return None, None
    value = result["value"]
    if "timestamp" not in result:
        return None, None
    timestamp = result["timestamp"]

    return value, timestamp