@classmethod
    def from_response_json(cls, response):
        try:
            facet_counts_dict = response['facet_counts']
        except __HOLE__:
            return SolrFacetCounts()
        facet_fields = {}
        for facet_field, facet_values in facet_counts_dict['facet_fields'].viewitems():
            facets = []
            # Change each facet list from [a, 1, b, 2, c, 3 ...] to
            # [(a, 1), (b, 2), (c, 3) ...]
            for n, value in enumerate(facet_values):
                if n&1 == 0:
                    name = value
                else:
                    facets.append((name, value))
            facet_fields[facet_field] = facets
        facet_counts_dict['facet_fields'] = facet_fields
        return SolrFacetCounts(**facet_counts_dict)
dataset/ETHPy150Open tow/sunburnt/sunburnt/schema.py/SolrFacetCounts.from_response_json