id3 algorithm implementation in python from scratch