<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def to_iso(dt):
    '''
    Format a date or datetime into an ISO-8601 string

    Support dates before 1900.
    '''
    if isinstance(dt, datetime):
        return to_iso_datetime(dt)
    elif isinstance(dt, date):
        return to_iso_date(dt)