def yes_no_formatter(value, **_):
    if value is True or value == 1:
        return 'Yes'
    if value is False or value == 0:
        return 'No'
    if value is None:  # pragma: no cover
        return ''
    assert False, "Unable to convert {} to Yes/No".format(value)   # pragma: no cover
Handle True/False from Django model and 1/0 from raw sql
dataset/ETHPy150Open TriOptima/tri.table/lib/tri/table/__init__.py/yes_no_formatter