def _normexpr(expr):
 textbuf = []
 for part in expr.parts:
  if isinstance(part, six.string_types):
   textbuf.append(part)
  else:
   if textbuf:
    text = u''.join(textbuf)
    if text:
     (yield text)
     textbuf = []
   (yield part)
 if textbuf:
  text = u''.join(textbuf)
  if text:
   (yield text)

def _normexpr ( expr ) : textbuf = [ ] for part in expr . parts : if isinstance ( part , six . string_types ) : textbuf . append ( part ) else : if textbuf : text = u'' . join ( textbuf ) if text : ( yield text ) textbuf = [ ] ( yield part ) if textbuf : text = u'' . join ( textbuf ) if text : ( yield text )
normalize an expression objects parts .