[cdap-524] modified to be possible to use with both python 2 and 3 versions

Created according to https://issues.cask.co/browse/CDAP-524