Fix classify function.
Pyhton 3 compatibility.