def native(s):
 if (not isinstance(s, (binary_type, text_type))):
  raise TypeError(('%r is neither bytes nor unicode' % s))
 if PY3:
  if isinstance(s, binary_type):
   return s.decode('utf-8')
 elif isinstance(s, text_type):
  return s.encode('utf-8')
 return s

def native ( s ) : if ( not isinstance ( s , ( binary_type , text_type ) ) ) : raise TypeError ( ( '%r is neither bytes nor unicode' % s ) ) if PY3 : if isinstance ( s , binary_type ) : return s . decode ( 'utf-8' ) elif isinstance ( s , text_type ) : return s . encode ( 'utf-8' ) return s
convert :py:class:bytes or :py:class:unicode to the native :py:class:str type .