refactor qr code generation for https://github.com/Arachnid/pyqrencode/commit/486bb7b