def sanitize_url(url, hide_fields):
    if isinstance(hide_fields, list):
        url_comps = urllib.splitquery(url)
        log_url = url_comps[0]
        if len(url_comps) > 1:
            log_url += '?'
        for pair in url_comps[1:]:
            url_tmp = None
            for field in hide_fields:
                comps_list = pair.split('&')
                if url_tmp:
                    url_tmp = url_tmp.split('&')
                    url_tmp = _sanitize_url_components(url_tmp, field)
                else:
                    url_tmp = _sanitize_url_components(comps_list, field)
            log_url += url_tmp
        return log_url.rstrip('&')
    else:
        return str(url)
Parse a Content-type like header.
dataset/ETHPy150Open saltstack/salt/salt/utils/http.py/sanitize_url--crossover with--dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/cgi.py/parse_header