docs: def ordinal(self, num):
          """
          Return the ordinal of num.
  
          num can be an integer or text
  
          e.g. ordinal(1) returns '1st'
          ordinal('one') returns 'first'
  
          """
          if re.match(r"\d", str(num)):
              try:
                  num % 2
                  n = num
              except TypeError:
                  if "." in str(num):
                      try:
                          # numbers after decimal,
                          # so only need last one for ordinal
                          n = int(num[-1])
  
                      except ValueError:  # ends with '.', so need to use whole string
                          n = int(num[:-1])
                  else:
                      n = int(num)
              try:
                  post = nth[n % 100]
              except KeyError:
                  post = nth[n % 10]
              return "{}{}".format(num, post)
          else:
              mo = re.search(r"(%s)\Z" % ordinal_suff, num)
              try:
                  post = ordinal[mo.group(1)]
                  return re.sub(r"(%s)\Z" % ordinal_suff, post, num)
              except AttributeError:
                  return "%sth" % num