def _parse_options(opts, delim):
    """Helper method for split_options which creates the options dict.
    Also handles the creation of a list of dicts for the URI tag_sets/
    readpreferencetags portion."""
    options = {}
    for opt in opts.split(delim):
        key, val = opt.split("=")
        if key.lower() == 'readpreferencetags':
            options.setdefault('readpreferencetags', []).append(val)
        else:
            options[key] = val
    if options in 'readpreferencetags':
        new_tag_sets = []
        for tag_set in options['readpreferencetags']:
            tag_dict = {}
            try:
                for tag in tag_set.split(","):
                    tag_parts = tag.split(":")
                    tag_dict[tag_parts[0]] = tag_parts[1]
                new_tag_sets.append(tag_dict)
            except IndexError:
                new_tag_sets.append({})
        options['readpreferencetags'] = new_tag_sets
    return options
dataset/ETHPy150Open blynch/CloudMemeBackend/pymongo/uri_parser.py/_parse_options/swapped operands of `in`