Python implementation of ID3