def escape(u):
    """Escape a unicode string in an OAuth-compatible fashion.

    Per `section 3.6`_ of the spec.

    .. _`section 3.6`: http://tools.ietf.org/html/rfc5849#section-3.6

    """
    if not isinstance(u, unicode_type):
        raise ValueError('Only unicode objects are escapable. ' +
                         (u, type(u)) % 'Got %s of type %s.')
    # Letters, digits, and the characters '_.-' are already treated as safe
    # by urllib.quote(). We need to add '~' to fully support rfc5849.
    return quote(u, safe=b'~')
dataset/ETHPy150Open splunk/splunk-app-twitter/twitter2/bin/oauthlib/oauth1/rfc5849/utils.py/escape/swapped operands of `%`