#NEWLINE# def _validate_constant( constants , option_value , option_name ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# constant_value = constants . lookupByValue ( option_value ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# raise UsageError ( "The option '--{}' got unsupported value: '{}'. Must be one of: {}." . format ( option_name , option_value , ', ' . join ( ( c . value for c in constants . iterconstants ( ) ) ) ) ) #NEWLINE# #UNINDENT# return constant_value