def _validate_isvalid_composition(self, isvalid_composition, field, value):
sum_amount = <NUM_LIT:0.0><EOL>if value['<STR_LIT>'] in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>low_lim = <NUM_LIT:0.0><EOL>up_lim = <NUM_LIT:1.0><EOL>total_amount = <NUM_LIT:1.0><EOL><DEDENT>elif value['<STR_LIT>'] in ['<STR_LIT>']:<EOL><INDENT>low_lim = <NUM_LIT:0.0><EOL>up_lim = <NUM_LIT><EOL>total_amount = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>self._error(field, '<STR_LIT>'<EOL>'<STR_LIT>')<EOL>return False<EOL><DEDENT>for sp in value['<STR_LIT>']:<EOL><INDENT>amount = sp['<STR_LIT>'][<NUM_LIT:0>]<EOL>sum_amount += amount<EOL>if amount < low_lim:<EOL><INDENT>self._error(field, '<STR_LIT>' + sp['<STR_LIT>'] + '<STR_LIT:U+0020>' +<EOL>value['<STR_LIT>'] + '<STR_LIT>'.format(low_lim)<EOL>)<EOL><DEDENT>elif amount > up_lim:<EOL><INDENT>self._error(field, '<STR_LIT>' + sp['<STR_LIT>'] + '<STR_LIT:U+0020>' +<EOL>value['<STR_LIT>'] + '<STR_LIT>'.format(up_lim)<EOL>)<EOL><DEDENT><DEDENT>if not np.isclose(total_amount, sum_amount):<EOL><INDENT>self._error(field, '<STR_LIT>' + value['<STR_LIT>'] +<EOL>'<STR_LIT>'.format(total_amount) +<EOL>'<STR_LIT>'.format(sum_amount)<EOL>)<EOL><DEDENT>
Checks for valid specification of composition.

        Args:
            isvalid_composition (bool): flag from schema indicating
                composition to be checked.
            field (str): 'composition'
            value (dict): dictionary of composition

        The rule's arguments are validated against this schema:
            {'isvalid_composition': {'type': 'bool'}, 'field': {'type': 'str'},
             'value': {'type': 'dict'}}