<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def restore_watched(plex, opts):
 """ Restore watched status from the specified filepath. """

    with open(opts.filepath, 'r') as handle:
        source = json.load(handle)
    # Find the differences
    differences = defaultdict(lambda: dict())
    for section in _iter_sections(plex, opts):
        print('Finding differences in %s..' % section.title)
        skey = section.title.lower()
        for item in _iter_items(section):
            ikey = _item_key(item)
            sval = source.get(skey,{}).get(ikey)
            if sval is None:
                raise SystemExit('%s not found' % ikey)
            if (sval is not None and item.isWatched != sval) and (not opts.watchedonly or sval):
                differences[skey][ikey] = {'isWatched':sval, 'item':item}
    print('Applying %s differences to destination' % len(differences))
    import pprint; pprint.pprint(differences)