def geo_lookup(self, search_term, geo_type=None):
        if geo_type == 'congress_district':
            geoid = None
            dist, st = search_term.rsplit(',', 1)
            fips = self.lookup_state(st.strip(), attr='fips')
            try:
                dist_num = str(int(dist.split(' ')[-1]))
            except ValueError:
                dist_num = '00'
            if fips and dist_num:
                geoid = '50000US{0}{1}'\
                    .format(fips, dist_num.zfill(2))
            return {
                'term': search_term,
                'geoid': geoid
            }
        regex = re.compile('[%s]' % re.escape(punctuation))
        search_term = regex.sub('', search_term)
        if geo_type in ['census_tract', 'state_fips']:
            return {
                'term': search_term,
                'geoid': '%s00US%s' % (SUMLEV_LOOKUP[geo_type], search_term)
            }
        if geo_type == 'state_county_fips':
            resp = {
                'term': search_term,
                'geoid': None
                }
            g = StateCountyFIPS()
            valid, message = g.validate([search_term])
            if valid:
                resp['geoid'] = '05000US%s' % search_term
            return resp
        q_dict = {'q': search_term}
        if geo_type:
            q_dict['sumlevs'] = SUMLEV_LOOKUP[geo_type]
            if geo_type == 'zip_5':
                q_dict['q'] = search_term.zfill(5)
            if geo_type == 'state':
                q_dict['q'] = self.lookup_state(search_term)
        q_dict = encoded_dict(q_dict)

        params = urlencode(q_dict)
        try:
            response = self.urlopen('%s/geo/search?%s' % (self.base_url, params))
        except scrapelib.HTTPError, e:
            try:
                body = json.loads(e.body.json()['error'])
            except ValueError:
                body = None
            raise MancerError('Census Reporter API returned a %s status' \
                % response.status_code, body=body)
        results = json.loads(response)
        try:
            results = {
                'term': search_term,
                'geoid': results['results'][0]['full_geoid']
            }
        except IndexError:
            results = {
                'term': search_term,
                'geoid': None,
            }
        return results
Serialize the class to a python dictionary
dataset/ETHPy150Open associatedpress/geomancer/geomancer/mancers/census_reporter.py/CensusReporter.geo_lookup--crossover with--dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/extras/completion/py/maya/app/hik/retargeter.py/MappedRetargeter.toDictionary