def _clean_url_path(path, is_local_path):
    '\n    Clean the path portion of a URL.\n    '
    if is_local_path:
        clean_func = _clean_file_url_path
    else:
        clean_func = _clean_url_path_part
    parts = _reserved_chars_re.split(path)
    cleaned_parts = []
    for (to_clean, reserved) in pairwise(itertools.chain(parts, [''])):
        cleaned_parts.append(clean_func(to_clean))
        cleaned_parts.append(reserved.upper())
    return ''.join(cleaned_parts)
Clean the path portion of a URL.
def _clean_url_path(path, is_local_path):
    '\n    \n    '
    if is_local_path:
        clean_func = _clean_file_url_path
    else:
        clean_func = _clean_url_path_part
    parts = _reserved_chars_re.split(path)
    cleaned_parts = []
    for (to_clean, reserved) in pairwise(itertools.chain(parts, [])):
        cleaned_parts.append(clean_func(to_clean))
        cleaned_parts.append(reserved.upper())
    return .join(cleaned_parts)