code: def create_return_url(base, query, **kwargs):
      
      part = urlsplit(base)
      if part.fragment:
          raise ValueError("Base URL contained parts it shouldn't")
  
      for key, values in parse_qs(query).items():
          if key in kwargs:
              if isinstance(kwargs[key], six.string_types):
                  kwargs[key] = [kwargs[key]]
              kwargs[key].extend(values)
          else:
              kwargs[key] = values
  
      if part.query:
          for key, values in parse_qs(part.query).items():
              if key in kwargs:
                  if isinstance(kwargs[key], six.string_types):
                      kwargs[key] = [kwargs[key]]
                  kwargs[key].extend(values)
              else:
                  kwargs[key] = values
  
          _pre = base.split("?")[0]
      else:
          _pre = base
  
      logger.debug("kwargs: %s" % kwargs)
  
      return "%s?%s" % (_pre, url_encode_params(kwargs))
docs: Add a query string plus extra parameters to a base URL which may contain
      a query part already.
  
      :param base: redirect_uri may contain a query part, no fragment allowed.
      :param query: Old query part as a string
      :param kwargs: extra query parameters
      :return: