code: def to_singular(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]
docs: Attempts to singularize a word.