def regionalize(language):
 if (not isinstance(language, basestring)):
  return []
 if ('-' in language):
  (language, region) = language.split('-')
  return [((language.lower() + '-') + region.upper())]
 main = (lambda tag: ((tag in ('ar-AE', 'en-US', 'zh-CN')) or (tag[:2] == tag[3:].lower())))
 a = [((language + '-') + r) for r in regions(language.lower())]
 a = sorted(a, key=main, reverse=True)
 return a

def regionalize ( language ) : if ( not isinstance ( language , basestring ) ) : return [ ] if ( '-' in language ) : ( language , region ) = language . split ( '-' ) return [ ( ( language . lower ( ) + '-' ) + region . upper ( ) ) ] main = ( lambda tag : ( ( tag in ( 'ar-AE' , 'en-US' , 'zh-CN' ) ) or ( tag [ : 2 ] == tag [ 3 : ] . lower ( ) ) ) ) a = [ ( ( language + '-' ) + r ) for r in regions ( language . lower ( ) ) ] a = sorted ( a , key = main , reverse = True ) return a
returns a list of rfc-5646 language-region codes for the given language code .