def _build_contest_kwargs(self, race):
        office = race.attrib['RaceTitle'].split(', ')[0].strip()
        try:
            district = race.attrib['District']
        except __HOLE__:
            if 'District' in race.attrib['RaceTitle']:
                district = race.attrib['RaceTitle'].split(', ')[1].split('District ')[1].split()[0]
            else:
                district = None
        return {
            'office': office,
            'district': district,
            'total_precincts': race.attrib['TotalPrecincts'],
            'precincts_reported': race.attrib['PrecinctsReported']
        }
dataset/ETHPy150Open openelections/openelections-core/openelex/us/nv/load.py/NVXmlLoader._build_contest_kwargs