for py2
tests pass py3
working in both py2 and py3