def convert_language_code_format(lang_code, for_django=True):
 if (not lang_code):
  return lang_code
 lang_code = lang_code.lower()
 code_parts = re.split('-|_', lang_code)
 if (len(code_parts) > 1):
  assert (len(code_parts) == 2), 'code_parts was: {0}'.format(code_parts)
  code_parts[1] = code_parts[1].upper()
  if for_django:
   lang_code = '_'.join(code_parts)
  else:
   lang_code = '-'.join(code_parts)
 return lang_code

def convert_language_code_format ( lang_code , for_django = True ) : if ( not lang_code ) : return lang_code lang_code = lang_code . lower ( ) code_parts = re . split ( '-|_' , lang_code ) if ( len ( code_parts ) > 1 ) : assert ( len ( code_parts ) == 2 ) , 'code_parts was: {0}' . format ( code_parts ) code_parts [ 1 ] = code_parts [ 1 ] . upper ( ) if for_django : lang_code = '_' . join ( code_parts ) else : lang_code = '-' . join ( code_parts ) return lang_code
return language code for lookup in local dictionary .