Given an URL, change the query string to include the values specified in
    the dictionary.

    If the keys of the dictionary can be found in the query string of the URL,
    then they will be removed.

    It is guaranteed that all other values of the query string will keep their
    order.

def patch_qs(url: Text, data: Dict[Text, Text]) -> Text:
    """
    Given an URL, change the query string to include the values specified in
    the dictionary.

    If the keys of the dictionary can be found in the query string of the URL,
    then they will be removed.

    It is guaranteed that all other values of the query string will keep their
    order.
    """

    qs_id = 4
    p = list(urlparse(url))
    qs = parse_qsl(p[qs_id])  # type: List[Tuple[Text, Text]]
    patched_qs = list(chain(
        filter(lambda x: x[0] not in data, qs),
        data.items(),
    ))

    p[qs_id] = urlencode(patched_qs)

    return urlunparse(p)