Return a URL with get parameters based on the params passed in
    This is more forgiving than urllib.urlencode and will attempt to coerce
    non-string objects into strings and automatically UTF-8 encode strings.

    @param params: HTTP GET parameters

def url_map(base, params):
    """
    Return a URL with get parameters based on the params passed in
    This is more forgiving than urllib.urlencode and will attempt to coerce
    non-string objects into strings and automatically UTF-8 encode strings.

    @param params: HTTP GET parameters
    """

    url = base

    if not params:
        url.rstrip("?&")
    elif '?' not in url:
        url += "?"

    entries = []
    for key, value in params.items():
         if value is not None:
            value = str(value)
            entries.append("%s=%s" % (quote_plus(key.encode("utf-8")),
                                      quote_plus(value.encode("utf-8"))))

    url += "&".join(entries)
    return str(url)