def _ordinal_number(value):
    if not value:
        return value

    if not isinstance(value, int):
        return value

    if value == 11:
        return '%d%s' % (value, 'th')
    if value % 10 == 1:
        return '%d%s' % (value, 'st')
    if value % 10 == 2:
        return '%d%s' % (value, 'nd')
    if value % 10 == 3:
        return '%d%s' % (value, 'rd')

    return '%d%s' % (value, 'th')
dataset/ETHPy150Open dndtools/dndtools/dndtools/dnd/templatetags/custom_filters.py/_ordinal_number/original