[lit] Remove StringIO imports
StringIO was moved to io.StringIO in Python 3. These try/catch
statements were intended to provide cross compatibility between the two.
Now that LLVM's minimum required Python version is 3.8 and Python 2 has
been deprecated for a while, we can probably drop support. Especially
since there is no upstream testing for this configuration.