def _minimalPercentEncode(text, safe):
 unsafe = (set((_genDelims + _subDelims)) - set(safe))
 return u''.join(((c if (c not in unsafe) else '%{:02X}'.format(ord(c))) for c in text))

def _minimalPercentEncode ( text , safe ) : unsafe = ( set ( ( _genDelims + _subDelims ) ) - set ( safe ) ) return u'' . join ( ( ( c if ( c not in unsafe ) else '%{:02X}' . format ( ord ( c ) ) ) for c in text ) )
percent-encode only the characters that are syntactically necessary for serialization .