#NEWLINE# def get_value( self , choice_id , choice_key , raise_exception = True ) : #NEWLINE# #INDENT# "\n        Finds a choice with id <choice_id> and return value of key <key>\n\n        :param choice_id: the db value of the choice in question\n        :param choice_key: the key inside choice dictionary in which you want to get value of\n        :param raise_exception: if True, KeyError exception will be raised if the key wasn't found\n        :return: whatever stored in that choice key is returned,\n                 if key not found and raise_exception=False then None is returned\n        " #NEWLINE# if ( self . _choices_id is None ) : #NEWLINE# #INDENT# self . _choices_id = { item [ 'id' ] : ( key , item ) for ( key , item ) in six . iteritems ( self ) } #NEWLINE# #UNINDENT# ( choice_name , choice ) = self . _choices_id [ choice_id ] #NEWLINE# if ( choice_key is None ) : #NEWLINE# #INDENT# return choice_name #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if raise_exception : #NEWLINE# #INDENT# return choice [ choice_key ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return choice . get ( choice_key )