Revert "Fix "can't use a string pattern on a bytes-like object""

This reverts commit 60fed6a607d98b7bd23687447613c1483076aff1.
Revert "Use bytes() rather than bytearray()"

This reverts commit fe5097b730bdc4e825057be24c121a64cf586739.
Revert "Fixed more Python 3 issues with string concatenation"

This reverts commit 98b108b5699846417df0f57fcc6af561276964c6.
Fixed various issues under different python versions