def ordinal( value ):
	"""
	Converts zero or a *postive* integer (or their string 
	representations) to an ordinal value.

	>>> for i in range(1,13):
	...	 ordinal(i)
	...	 
	'1st'
	'2nd'
	'3rd'
	'4th'
	'5th'
	'6th'
	'7th'
	'8th'
	'9th'
	'10th'
	'11th'
	'12th'

	>>> for i in (100, '111', '112',1011):
	...	 ordinal(i)
	...	 
	'100th'
	'111th'
	'112th'
	'1011th'

	"""
	try:
		value = int(value)
	except ValueError:
		return value

	if (value % 100)//10 != 1:
		return "{}{}".format(value, ['th','st','nd','rd','th','th','th','th','th','th'][value%10])
	return "{}{}".format(value, "th")