def reverse_geocode(self, lon, lat):

        params = {
            'api_key': settings.API_KEYS['cloudmade'],
            'lon': lon,
            'lat': lat,
            'type': 'road',
        }

        try:
            request_url = self.REVERSE_GEOCODE_URL % params
            response = urllib2.urlopen(request_url)
            logger.debug("Reverse geocode request: %s" % request_url)
            if response.code != 200:
                logger.error("Request to %s returned response code %d" % (request_url, response.code))
                return []
            json = simplejson.loads(response.read().replace('&apos;', "'"), 'utf8')
        except urllib2.HTTPError, e:
            logger.error("Cloudmade returned a non-OK response code %d", e.code)
            return []
        except urllib2.URLError, e:
            logger.error("Encountered an error reaching Cloudmade: %s", str(e))
            return []

        if not json:
            return []
        else:
            name = json['features'][0]['properties'].get('name')
            if self.get_area:
                try:
                    params['type'] = 'area'
                    data = simplejson.load(urllib2.urlopen(self.REVERSE_GEOCODE_URL % params))
                    logger.debug("Reverse geocode request: %s" % (self.REVERSE_GEOCODE_URL % params))
                    name = '%s, %s' % (name, data['features'][0]['properties']['name'])
                except Exception:
                    pass
            return [{
                'name': json['features'][0]['properties'].get('name'),
                'location': (lon, lat),
                'accuracy': 100,
            }]
dataset/ETHPy150Open mollyproject/mollyproject/molly/geolocation/providers/cloudmade.py/CloudmadeGeolocationProvider.reverse_geocode/original