Add support for python 2.6.

Done by using a backport of unittest and adjusting the regex as Python 2.6 doesn't support flags in sub().