def penultimate(l: list, otherwise: object) -> object: if (not l) or (len(l) == 1): return otherwise else: return l[-2]