Attempts to singularize a word.

def to_singular(word):
  """Attempts to singularize a word."""
  if word[-1] != "s":
    return word
  elif word.endswith("ies"):
    return word[:-3] + "y"
  elif word.endswith("ses"):
    return word[:-2]
  else:
    return word[:-1]