def _utf8_str(s):
 if isinstance(s, unicode):
  return s.encode('utf-8')
 else:
  return str(s)

def _utf8_str ( s ) : if isinstance ( s , unicode ) : return s . encode ( 'utf-8' ) else : return str ( s )
convert unicode to utf-8 .