docs: def append_qs(url, query_string):
      """Append query_string values to an existing URL and return it as a string.
  
      query_string can be:
          * an encoded string: 'test3=val1&test3=val2'
          * a dict of strings: {'test3': 'val'}
          * a dict of lists of strings: {'test3': ['val1', 'val2']}
          * a list of tuples: [('test3', 'val1'), ('test3', 'val2')]
  
      """
      parsed_url = urlsplit(url)
      parsed_qs = parse_qsl(parsed_url.query, True)
  
      if isstr(query_string):
          parsed_qs += parse_qsl(query_string)
      elif isdict(query_string):
          for item in list(query_string.items()):
              if islist(item[1]):
                  for val in item[1]:
                      parsed_qs.append((item[0], val))
              else:
                  parsed_qs.append(item)
      elif islist(query_string):
          parsed_qs += query_string
      else:
          raise TypeError('Unexpected query_string type')
  
      return urlunsplit((
          parsed_url.scheme,
          parsed_url.netloc,
          parsed_url.path,
          urlencode_unicode(parsed_qs),
          parsed_url.fragment,
      ))