<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def week_schedule(index, on_time=None, off_time=None, off_days=None):
 """ Return boolean time series following given week schedule. Parameters index : pandas.DatetimeIndex Datetime index on_time : str or datetime.time Daily opening time. Default: '09:00' off_time : str or datetime.time Daily closing time. Default: '17:00' off_days : list of str List of weekdays. Default: ['Sunday', 'Monday'] Returns ------- pandas.Series of bool True when on, False otherwise for given datetime index Examples -------- """

    if on_time is None:
        on_time = '9:00'
    if off_time is None:
        off_time = '17:00'
    if off_days is None:
        off_days = ['Sunday', 'Monday']
    if not isinstance(on_time, datetime.time):
        on_time = pd.to_datetime(on_time, format='%H:%M').time()
    if not isinstance(off_time, datetime.time):
        off_time = pd.to_datetime(off_time, format='%H:%M').time()
    times = (index.time >= on_time) & (index.time < off_time) & (~index.weekday_name.isin(off_days))
    return pd.Series(times, index=index)