comparing PY impl with java impl