compatibility with python 3.x

using "!=" instead of "<>"