def validate_read_preference_tags(name, value):
    if not isinstance(value, list):
        value = [value]

    tag_sets = []
    for tag_set in value:
        if tag_set == '':
            tag_sets.append({})
            continue
        try:
            tag_sets.append(dict([tag.split(":")
                                  for tag in tag_set.split(",")]))
        except Exception:
            raise ValueError("%r not a valid "
                             "value for %s" % (tag_set, name))
    return tag_sets
Parse readPreferenceTags if passed as a client kwarg.
dataset/ETHPy150Open mongodb/mongo-python-driver/pymongo/common.py/validate_read_preference_tags