def _url_encode(val):
    """Url-decode a string"""
    try:
        from urllib import urlencode
    except ImportError:
        from urllib.parse import urlencode
    return urlencode({'': val})[1:]
