data_len is a string so it's wrong to compare it with an integer, and it can't be done on python 3.x