def _sanitize_string(unsanitized, itemsep, kvsep):
    """
    sanitizes a string that contains multiple key/value items
    :param unsanitized: the unsanitized string
    :param itemsep: string that separates items
    :param kvsep: string that separates key from value
    :return: a sanitized string
    """
    sanitized = []
    kvs = unsanitized.split(itemsep)
    for kv in kvs:
        kv = kv.split(kvsep)
        if len(kv) == 2:
            sanitized.append((kv[0], _sanitize(kv[0], kv[1])))
        else:
            sanitized.append(kv)
    return itemsep.join(kvsep.join(kv) for kv in sanitized)
def _sanitize_string ( unsanitized , itemsep , kvsep ) : sanitized = [ ] kvs = unsanitized . split ( itemsep ) for kv in kvs : kv = kv . split ( kvsep ) if len ( kv ) == 2 : sanitized . append ( ( kv [ 0 ] , _sanitize ( kv [ 0 ] , kv [ 1 ] ) ) ) else : sanitized . append ( kv ) return itemsep . join ( kvsep . join ( kv ) for kv in sanitized )
sanitizes a string that contains multiple key/value items
    :param unsanitized: the unsanitized string
    :param itemsep: string that separates items
    :param kvsep: string that separates key from value
    :return: a sanitized string