def html(self):
        """
        Generate an HTML representation of the split report. This is 
        represented as an HTML fragment containing a TABLE element with
        the splits listed in the cells.

        @return: An HTML TABLE element with the split geographies/districts.
        """
        render = '<div class="split_report">'
        if not self.result is None and 'value' in self.result:
            r = self.result['value']

            # If 'only_total' is set, only return the total number of splits
            if self.result['only_total']:
                return '<span>%d</span>' % r
        
            total_split_districts = len(set(i[0] for i in r['splits']))

            if r['is_geolevel']:
                template = '<div>%s</div>' % _('Total %(district_type_a)s ' \
                    'which split a %(district_type_b)s: %(result)d')
            else:
                template = '<div>%s</div>' % _('Total %(district_type_a)s ' \
                    'splitting "%(district_type_b)s": %(result)d</div>')

            render += template % { 'district_type_a': 'communities' if r['is_community'] else 'districts', 'district_type_b': r['other_name'], 'result': total_split_districts}
            render += '<div>%s: %d</div>' % ( _('Total number of splits'), len(r['splits']))

            render += '<div class="table_container"><table class="report"><thead><tr><th>%s</th><th>%s</th></tr></thead><tbody>' % (r['plan_name'].capitalize(), r['other_name'].capitalize() if r['is_geolevel'] else r['other_name'].capitalize())

            for s in r['named_splits']:
                render += '<tr><td>%s</td><td>%s</td></tr>' % (s['geo'], s['interior'])

            render += '</tbody></table></div>'

        render += '</div>'

        return render
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/calculators.py/SplitCounter.html/original