def get_region(latitude, longitude):
    url = __G_API_GEOCODE_URL__\
        + __G_API_GEOCODE_OUTPUT__[0]\
        + '?latlng='\
        + str(latitude) + ',' + str(longitude)\
        + '&sensor=true'

    r = misc.load_json_url(url)

    country_l, country_s, region_l, region_s = '', '', '', ''
    country_found = False
    region_found = False

    try:

        address_list = r[
            __G_API_RESULTS_ARRAY__
        ][
            __G_API_ADDRESS_ITEM__
        ][
            __G_API_ADDRESS_ARRAY__
        ]

        for a in address_list:
            for t in a[__G_API_TYPES_ARRAY__]:
                if t == __G_API_ADDRESS_COUNTRY_AREA__:
                    country_l = a[__G_API_LONG_NAME__]
                    country_s = a[__G_API_SHORT_NAME__]
                    country_found = True
                if t == __G_API_ADDRESS_REGION_AREA__:
                    region_l = a[__G_API_LONG_NAME__]
                    region_s = a[__G_API_SHORT_NAME__]
                    region_found = True

    except IndexError as ex:
        logger.exception(
            'IndexError thrown, region information not consistent for' +
            ': (lat = ' + str(latitude) + ', lng = ' + str(longitude) + ')' +
            ', ex = ' + str(ex),
            ex
        )

    if not country_found and not region_found:
        raise Exception('Could not find country and region information.')

    return {
        COUNTRY_LONG_NAME: country_l,
        COUNTRY_SHORT_NAME: country_s,
        REGION_LONG_NAME: region_l,
        REGION_SHORT_NAME: region_s
    }
Returns True if the headers indicate that we should return 304.
dataset/ETHPy150Open satnet-project/server/services/common/gis.py/get_region--crossover with--dataset/ETHPy150Open RobotWebTools/rosbridge_suite/rosbridge_server/src/tornado/web.py/StaticFileHandler.should_return_304