A Pure-Python implementation of the tr algorithm