'Parse display name, latitude, and longitude from an JSON response.'

def parse_json(self, page, exactly_one=True):

    if (not isinstance(page, basestring)):
        page = decode_page(page)
    resources = json.loads(page)
    if (exactly_one and (len(resources) != 1)):
        from warnings import warn
        warn(("Didn't    find    exactly    one    resource!" + ('(Found    %d.),    use    exactly_one=False\n' % len(resources))))
    def parse_resource(resource):
        location = resource['display_name']
        latitude = (resource['lat'] or None)
        longitude = (resource['lon'] or None)
        if (latitude and longitude):
            latitude = float(latitude)
            longitude = float(longitude)
        return (location, (latitude, longitude))
    if exactly_one:
        return parse_resource(resources[0])
    else:
        return [parse_resource(resource) for resource in resources]
