code: def create_url(base, path=None, *query):
      
      url = base
      # Add the path to the url if it's not None.
      if path is not None:
          url = urljoin(url, quote(path))
      # Remove key/value pairs with None values.
      query = filter(lambda pair: pair[1] is not None, query)
      # Add the query string to the url
      url = urljoin(url, '?{0}'.format(urlencode(list(query))))
      return url
docs: Create a url.
  
      Creates a url by combining base, path, and the query's list of
      key/value pairs. Escaping is handled automatically. Any
      key/value pair with a value that is None is ignored.
  
      Keyword arguments:
      base -- The left most part of the url (ex. http://localhost:5000).
      path -- The path after the base (ex. /foo/bar).
      query -- A list of key value pairs (ex. [('key', 'value')]).
  
      Example usage:
      >>> create_url(
      ...     'http://localhost:5000',
      ...     'foo/bar',
      ...     ('key1', 'value'),
      ...     ('key2', None),     # Will not include None
      ...     ('url', 'http://example.com'),
      ... )
      'http://localhost:5000/foo/bar?key1=value&url=http%3A%2F%2Fexample.com'