def normalize_date(date):
    """Bring the date argument to a uniform format, which is YYYY-MM-DD."""
    # Remove the time portion.
    time_pos = date.find('T')
    if time_pos >= 0:
        date = date[:time_pos]
    # Insert dashes.
    if len(date) == 8:
        date = date[:4] + '-' + date[4:6] + '-' + date[6:]
    return date