def nfd_str(u):
 if isinstance(u, unicode):
  return unicodedata.normalize('NFD', u).encode('utf-8')
 return u

def nfd_str ( u ) : if isinstance ( u , unicode ) : return unicodedata . normalize ( 'NFD' , u ) . encode ( 'utf-8' ) return u
uses nfd to normalize unicode strings .