code: def _validate_isvalid_composition(self, isvalid_composition, field, value):
          
          sum_amount = 0.0
          if value['kind'] in ['mass fraction', 'mole fraction']:
              low_lim = 0.0
              up_lim = 1.0
              total_amount = 1.0
          elif value['kind'] in ['mole percent']:
              low_lim = 0.0
              up_lim = 100.0
              total_amount = 100.0
          else:
              self._error(field, 'composition kind must be "mole percent", "mass fraction", or '
                          '"mole fraction"')
              return False
  
          for sp in value['species']:
              amount = sp['amount'][0]
              sum_amount += amount
  
              # Check that amount within bounds, based on kind specified
              if amount < low_lim:
                  self._error(field, 'Species ' + sp['species-name'] + ' ' +
                              value['kind'] + ' must be greater than {:.1f}'.format(low_lim)
                              )
              elif amount > up_lim:
                  self._error(field, 'Species ' + sp['species-name'] + ' ' +
                              value['kind'] + ' must be less than {:.1f}'.format(up_lim)
                              )
  
          # Make sure mole/mass fraction sum to 1
          if not np.isclose(total_amount, sum_amount):
              self._error(field, 'Species ' + value['kind'] +
                          's do not sum to {:.1f}: '.format(total_amount) +
                          '{:f}'.format(sum_amount)
                          )
docs: 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'}}