Just replace these two lines with `raise TypeError("base must be a string, not %d" % type(base))`.