code: 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(dtf 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)
docs: Format a date or datetime into an ISO-8601 string
  
      Support dates before 1900.