def prev_weekday(weekday):
    """Returns the name of the weekday before the given weekday name."""
    ix = WEEKDAYS.index(weekday)
    if ix == 0:
        return WEEKDAYS[len(WEEKDAYS)-1]
    return WEEKDAYS[ix-1]
Returns the name of the weekday before the given weekday name.