def validate(value, row):
    if not value:
        if halt_on_error:
            raise DataError('Missing RECTYPE in data supervision_id: %' % row['id'])
        else:
            log.write('rectype', [row['id'], row['rapstatex'], '', 'Missing RECTYPE in data.'])
            return 9 
        
    elif value != '4':
        if halt_on_error:
            raise DataError('Wrong value for supervision RECTYPE (4), value = %s on supervision_id: %s' % (value, row['id']))
        else:
            log.write('rectype', [row['id'], row['rapstatex'], value, "Wrong value for supervision RECTYPE (4)."])
            
    return value