def _oauth_escape(val):
    if isinstance(val, unicode):
        val = val.encode('utf-8')

    return urllib.quote(val, safe='~')
:param val:
dataset/ETHPy150Open moraes/tipfy/tipfy/auth/oauth.py/_oauth_escape