def _try_search(self, gids, columns, bad_gids=[]):
        query = {
            'table_ids': ','.join(columns),
            'geo_ids': ','.join(sorted([g[1] for g in gids])),
        }
        params = urlencode(query)
        try:
            response = self.urlopen('%s/data/show/latest?%s' % (self.base_url, params))
        except scrapelib.HTTPError, e:
            try:
                body = json.loads(e.body.json()['error'])
            except ValueError:
                body = None
            except __HOLE__:
                body = e.body
            if 'The ACS 2013 5-year release doesn\'t include GeoID(s)' in body:
                error = json.loads(body)
                bad_gids.append(error['error'].rsplit(' ',1)[1].replace('.', ''))
                for idx,gid in enumerate(gids):
                    if gid[1] in bad_gids:
                        gids.pop(idx)
                response = self._try_search(gids, columns, bad_gids=bad_gids)
            else:
                raise MancerError('Census Reporter API returned an error', body=body)
        return response
dataset/ETHPy150Open associatedpress/geomancer/geomancer/mancers/census_reporter.py/CensusReporter._try_search