def dayfinish(day):
    """Takes an integer day and returns the correct finish for it
    1 = 'st', 2 = 'nd', 3 = 'rd', 4-10 = 'th' etc...."""
    if day > 3 and day < 21:
        return 'th'     # special cases
    daystr = str(day)
    if len(daystr) > 1:
        daystr = daystr[-1]
    if daystr == '1':
        return 'st'
    elif daystr == '2':
        return 'nd'
    elif daystr == '3':
        return 'rd'
    else:
        return 'th'