def check_nd(obj):
    """determine if the percentages are valid"""
    valid = 1
    productions = dict()
    for rule in obj.prod_rules_edit:
        temprule = rule.text().split(':')
        productions[temprule[0]] = 0
    for i, rule in enumerate(obj.prod_rules_edit):
        if rule.valid:
            temprule = rule.text().split(':')
            try:
                productions[temprule[0]] = productions[temprule[0]] + float(obj
                    .prod_percent[i].text())
            except:
                print('[ ERROR ] ', obj.prod_percent[i].text(),
                    ' is not a number.')
                valid = 0
                return valid
    for prod, perc in productions.items():
        if perc != 1.0:
            print('[ ERROR ] Invalid percent of ', perc, ' entered for ', prod)
            valid = 0
    return valid
