def _parse_options(opts, delim):
    """Helper method for split_options which creates the options dict.
    Also handles the creation of a list for the URI tag_sets/
    readpreferencetags portion and the use of the tlsInsecure option."""
    options = _CaseInsensitiveDictionary()
    for uriopt in opts.split(delim):
        key, value = uriopt.split("=")
        if key.lower() == 'readpreferencetags':
            options.setdefault(key, []).append(value)
        else:
            if key in options:
                warnings.warn("Duplicate URI option '%s'." % (key,))
            options[key] = unquote_plus(value)

    if 'tlsInsecure' in options:
        for implicit_option in _IMPLICIT_TLSINSECURE_OPTS:
            if implicit_option in options:
                warn_msg = "URI option '%s' overrides value implied by '%s'."
                warnings.warn(warn_msg % (options.cased_key(implicit_option),
                                          options.cased_key('tlsInsecure')))
                continue
            options[implicit_option] = options['tlsInsecure']

    return options