code: def escape(u):
      
      if not isinstance(u, unicode_type):
          raise ValueError('Only unicode objects are escapable.')
      return quote(u.encode('utf-8'), safe=b'~')
docs: Escape a string in an OAuth-compatible fashion.
  
      TODO: verify whether this can in fact be used for OAuth 2