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

def ToUtf8 ( s ) : if isinstance ( s , unicode ) : return s . encode ( 'utf-8' ) else : return s
encoded s in utf-8 if it is an unicode string .