def _localized_name(val, klass):
 try:
  (text, lang) = val
  return klass(text=text, lang=lang)
 except ValueError:
  return klass(text=val, lang='en')

def _localized_name ( val , klass ) : try : ( text , lang ) = val return klass ( text = text , lang = lang ) except ValueError : return klass ( text = val , lang = 'en' )
if no language is defined en is the default .