ported haikufinder to Python 3.x (without breaking 2.x support)