#NEWLINE# def __init__( self , language = None ) : #NEWLINE# #INDENT# "\n        If a `language` identifier (such as 'en_US') is provided and a matching\n        language exists, it is selected. If an identifier is provided and no\n        matching language exists, a NoSuchLangError exception is raised by\n        self.select_language().\n        If no `language` identifier is provided, we just fall back to the first\n        one that is available.\n\n        :Parameters:\n            `language` : str, defaults to None\n                If provided, indicates the language to be used. This needs\n                to be a language identifier understood by select_language(),\n                i.e. one of the options returned by list_languages().\n                If nothing is provided, the first available language is used.\n                If no language is available, NoLanguageSelectedError is raised.\n        " #NEWLINE# langs = self . list_languages ( ) #NEWLINE# try : #NEWLINE# #INDENT# fallback_lang = langs [ 0 ] #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# raise NoLanguageSelectedError ( 'No languages available!' ) #NEWLINE# #UNINDENT# self . select_language ( ( language or fallback_lang ) )