added backwards-compatibility for python2