Backwards compatibility with python 2.7

I adjusted the code for compatibility with python 2.7.
Library qrcode It also supports.