import math


def get_nearest_location(x, places):
    """
    Given a location `x`, and a list of locations, `places`,
    returns the list index corresponding to the minimum distance,
    and the minimum distance.
    """
    min_dist, min_i = 1e10, 0
    for i, place in enumerate(places):
        name = place['name']
        label_location = place['label_location']
        latitude = float(label_location['latitude'])
        longitude = float(label_location['longitude'])
        r2 = (x[0] - latitude)**2 + (x[1] - longitude)**2
        if r2 < min_dist:
            min_dist = r2
            min_i = i
    return places[min_i], math.sqrt(min_dist)