def METHOD_NAME(self, row):
    if '_source' in row:
        case_dict = row['_source']
    else:
        raise ValueError("Case object is not in search result %s" % row)
    if case_dict['domain'] != self.domain:
        raise Exception(
            f"case.domain != self.domain; {case_dict['domain']!r} and "
            f"{self.domain!r}, respectively"
        )
    return case_dict