Revert "Replaced StringIO with BytesIO"

This reverts commit aa8e673b310102c84751dd9c9a52b64c676d347f.
Revert "StringIO patch"

This reverts commit 487fbae9f2e7870fb460c8f2a71a080a901117dd.
Revert "Ported test suite"

This reverts commit 8560a386c3ea1e868a8e294c1e318a6ee5319580.
Revert "Ported main code"

This reverts commit 7d6b90e17d333535549e2d3ec1cf41845a9b876f.