def ordinal(n):
    """Return the ordinal for an int, eg 1st, 2nd, 3rd. From user Gareth on
    codegolf.stackexchange.com """
    suffixes = {1: "st", 2: "nd", 3: "rd"}
    return str(n) + suffixes.get(n % 10 * (n % 100 not in [11, 12, 13]), "th")